I am trying to figure out the best way to approach this. I have a treeview that is using Hierarchal data from sql server tables. Using linq to generate the dbml and then binding the data to the treeview. Here is the part I am having trouble with. Say the treeview starts and goes Categories----->Authors----->Books------>CheckedOut

So If I wanted to color each item(red) and all the parent nodes(red) where the item is overdue based on a view I created in sql server (I have four different categories to highlight based on dates stored in the db) what would be the best approach for this in C# WPF?

有帮助吗?

解决方案

you can use a style trigger to trigger action when item in your tree view item meets certain condition

 <Style TargetType="TextBlock">
              <Style.Triggers>
                <DataTrigger Binding="{Binding Highlight}" Value="True">
                      <Setter Property="Background" Value="youcolor" />
                 </DataTrigger>
         </Style.Triggers>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top