473,385 Members | 1,834 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,385 software developers and data experts.

WPF-How to add color to Tree View created dynamically in WPF

DNB
I am trying to add color to tree View in WPF.

I am trying to use following line but it does not work:

item.Foreground = System.Drawing.Color.Red;

-------------------------------------------------------------------------------------------------TreeViewItem item = new TreeViewItem();item.Tag ="10"item.Header = "Test1"//FOLLOWING LINE DOES NOT WORKtem.Foreground = System.Drawing.Color.Red;item.Items.Add("*");tree. Items.Add(item);ThanksDNB

Feb 7 '08 #1
1 2440
does not work or does not compile?

foreground needs to be a brush, so try .Foreground = new
SolidColorBrush(Colors.Red);
"DNB" <ii@ii.comwrote in message
news:ed**************@TK2MSFTNGP04.phx.gbl...
>I am trying to add color to tree View in WPF.

I am trying to use following line but it does not work:

item.Foreground = System.Drawing.Color.Red;

-------------------------------------------------------------------------------------------------TreeViewItem
item = new TreeViewItem();item.Tag ="10"item.Header = "Test1"//FOLLOWING
LINE DOES NOT WORKtem.Foreground =
System.Drawing.Color.Red;item.Items.Add("*");tree. Items.Add(item);ThanksDNB

Feb 8 '08 #2

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

Similar topics

4
by: farseer | last post by:
Is WPF going replace Winforms? Where can WPF applications run currently? Must you have .net3.0 installed?
23
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I...
9
by: raylopez99 | last post by:
Took a quick look at WPF, wrote a hello world program, noted it's lack of a decent API (for example, no lightning bolt to add Event Handlers, and every control in WPF does not have as many event...
2
by: Dean Slindee | last post by:
Is there any control in WPF which can host a WPF window? If not now, are there any plans to improve WPF to implement window hosting. Related question: is it not possible to build a MDI application...
2
by: Dean Slindee | last post by:
I am not looking for a "hybrid" WPF/WinForm or WinForm/WPF solution, but rather a pure WPF/WPFsolution. I want to host a WPF window inside another WPF window. I want to host a WPF window as a...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.