Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

1 view
Skip to first unread message

DNB

unread,
Feb 7, 2008, 5:55:14 PM2/7/08
to
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

Radek Cerny

unread,
Feb 7, 2008, 8:04:22 PM2/7/08
to
does not work or does not compile?

foreground needs to be a brush, so try .Foreground = new
SolidColorBrush(Colors.Red);


"DNB" <i...@ii.com> wrote in message
news:ed0TByda...@TK2MSFTNGP04.phx.gbl...

0 new messages