Sunday 15 May 2011

c# - WPF - node style dependent from deep in tree -


I am looking for information about the preview style in WPF I want to set different text colors for each level of tree . I have 3 levels of trees.

Example:

- & gt; Root (Black)
- & gt; Level 1A (red)
- & gt; Level 2A (green)
- & gt; Level 2B (green)
- & gt; Level 1B (red)
- & gt; Level 2C (green)

Thank you in advance for your help.

You can bind color (foreground or background) to a visual model property with custom logic .

In your case, you should calculate the level with a little logic: Find the level of the parents' visual model and return 1 or Return 0 Parents are redundant.

If you are new to WPF and Tviewview, then I recommend reading it:

No comments:

Post a Comment