I have an issue.
I created a custom treeviewitem content:
By default the SimpleText foreground is black.
But when I choose that treeviewitem in a tree it's still black foreground.
How can I fix that?
Update: I found a selected event but how to update the color to black again when the node is unselected?
Update 2: I found an unselected event lol, now I have a problem: double click event on treeview not works anymore.
Update 3: i added DoubleClick event to treeviewitem instead, it works.
And now I have the same problem about the treeviewitem with the childs:
You can see my code for the changing colors of treeviewitem content:
item.Selected += delegate (object sender, RoutedEventArgs e) { lbl.Fill = new SolidColorBrush(Color.FromRgb(255, 255, 255)); };
item.Unselected += delegate (object sender, RoutedEventArgs e) { lbl.Fill = new SolidColorBrush(Color.FromRgb(0,0,0)); };
item.LostFocus += delegate (object sender, RoutedEventArgs e) { lbl.Fill = new SolidColorBrush(Color.FromRgb(0, 0, 0)); };
When the item is selected: item text color changed to white (gets blue bg)
When the item is unselected: item text changed to black (gets white bg)
When the item is lost focus: item text changed to black(gets gray bg)
Everything works well, but only with the treeviewitems that didn't have any children.
The items that contain some children are:
- Getting white text color when its children are selected (But getting black text color when its children are lost focus)
Please fix that bug. I think the bug isn't in theme. It's in the events. Maybe a treeviewitem with children does wrong events?
All that i do right now is to handle a treeviewitem with an icon. Maybe there easier ways?