Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Add color to WPF grid from code behind

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DNB - 28 Feb 2008 20:51 GMT
I would like to add this color   #E7EBF7 to my WPF data grid

I know that I can add light blue color using following:

Grid b = new Grid();

b.Background = System.Windows.Media.Brushes.LightBlue;

but how to add specific color (i.e. #E7EBF7 )

Thanks

DNB
Nicholas Paldino [.NET/C# MVP] - 28 Feb 2008 21:01 GMT
DNB,

   Just use a SolidColorBrush, like so:

// Create the color first.
System.Windows.Media.Color color = System.Windows.Media.Color.FromRgb((byte)
0xE7, (byte) 0xEB, (byte) 0xF7);

// Create the brush.
System.Windows.Media.SolidColorBrush brush = new
System.Windows.Media.SolidColorBrush(color);

// Set the background.
b.Background = brush;

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I would like to add this color   #E7EBF7 to my WPF data grid
>
[quoted text clipped - 9 lines]
>
> DNB
DNB - 29 Feb 2008 15:23 GMT
Thanks

DNB
> DNB,
>
[quoted text clipped - 24 lines]
>>
>> DNB

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.