473,383 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Add color to WPF grid from code behind

DNB
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


Feb 28 '08 #1
2 7834
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;
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DNB" <ii@ii.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
>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




Feb 28 '08 #2
DNB
Thanks

DNB
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
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;
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DNB" <ii@ii.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
>>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





Feb 29 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: nospam | last post by:
I just read on Slash Dot about partial types. Now, is it possible to have a code behind split over two pages but still referencing the same .aspx file??? If so, that would be really nice as...
5
by: Chung | last post by:
Hi All, Can anyone tell me how can I call a client script (javascript) from Code behind server code (c#)? Chung
2
by: Mark Fox | last post by:
Hello, In VS.NET 2003 when I add server controls to the web form it sometimes adds their declarations to the code behind and sometimes not. Is there a way to tell VS.NET to parse the web form...
8
by: Brett Robichaud | last post by:
I understand how code-behind can handle events for a page, but can I call a code-behind method from within a <script> tag in my ASP.Net page, or can I only call methods defined in other <script>...
2
by: Earl Teigrob | last post by:
I have created a simple custom control that uses a table to create space around its contents. The code in the aspx page is show below. My problem is that the controls within the template can not be...
6
by: Jim | last post by:
Group, How would I go about firing a JavaScript method from a C# method in the aspx code behind file? It seems as though this could not be done since JavaScript is executed from within the Web...
4
by: John E. | last post by:
I have an ASP.NET datagrid with several bound columns. I need to make the header of some of these columns display a string that is generated from the code behind (i.e. a dynamic header). How is...
1
by: Julius Fenata | last post by:
Hi all, How to synchronize Label1.text between: document.getElementById("Label1").innerText (at Client Script) & Label1.text (Code Behind). I mean, I have assign new value to Label1 in Client...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
19
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.