Hi, I have couple of questions on XamDataTree with CheckBox:
1. Currently, we can only check/uncheck the checkbox when click on the checkbox, is there a way to click on item, checkbox will be auto checked?
2. Select state and MouseOver state only change background color of an item, checkbox isn't included, can you provide sample to also highlight checkbox background?
3. How to change the foreground color of selected item.
Thanks,
Crystal.
Hi Maria,
I have another question, we need is to have checkboxes in XamDataTree reflects what's set in its ItemsSource.
I tried with binding CheckBoxMemberPath to a property in data layer. However, the checkbox in parent node isn't updated accordingly, when it's leaf node is checked. Do you know how to set parent node checkbox to be in sync with it's leaf node. please see attached sample project.
Thank you for your feedback Crystal.I am glad that the approach did help you. If you have any other questions on the same, please feel free to ask.
Hi Maria, it's exactly what I need, thank you so much for your help!
Hello Crystal,
The foreground color of the node depends on the foreground color of the Textblock that is displayed in a ContentPresenter in the default template. To change it based on the check state you can use a DataTrigger for the node control like this: <Style.Triggers> <DataTrigger Binding="{Binding Path=Node.IsChecked}" Value="true"> <Setter Property="TextBlock.Foreground" Value="Yellow"/> </DataTrigger> </Style.Triggers>Let me know if you have any other questions.
Hi Maria, thank you for response and sample project. It's very helpful.
For setting selected item font color, I am trying to style xamDataTree following sample "Styling xamDataTree" in "Samples Browser" So the SelectedStates is set in code below
<VisualStateGroup x:Name="SelectedStates"> <VisualState x:Name="NotSelected"></VisualState> <VisualState x:Name="Selected"> <Storyboard> <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00" Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup>
Do you have sample code to show me how to set font color this way?
Thanks,Crystal.