How can i bind the IsEnabled property of the checkbox in a XamDataTree to a property for each node?
Hello Travis,
Thank you for contacting Infragistics. I have been looking into your question and I understand that you would like to make only the CheckBox of a particular node disabled. In order to achieve the desired behavior I got the default style for the XamDataTreeNodeControl and bind the ‘IsEnabled’ property of the CheckBox to a property of my underlying data.
I am attaching a sample application(DataTreeNodeLayoutsBinding.zip) that shows my approach.
Let me know, if you need any further assistance on this matter.
Works perfect! I just couldn't figure out the binding, this was what I needed. I was trying to use IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Node.IsEnabled}" , I needed to add "Data" into the path, ie Path=Node.Data.IsEnabled.
Where in the XAML can I alter the check in the disabled checkbox, it is very hard for the user to tell it is disabled?
Thank your for your reply. Could you please provide me with some more details on how exactly you want the disabled checkbox to appear ?
Looking forward to hearing from you.
I just want the checkmark inside of the disabled checkbox to be a little bit lighter than when enabled. So, if the checkmark is black when enabled, I want it gray when disabled. I found how to change the color of the checkmark <Path x:Name="checkBox" Height="8" Width="10" Stretch="Fill" Visibility="Collapsed" Fill="{StaticResource CheckBoxGlyphBackgroundBrush}"
but that controls it in any state, I want to only change it when the checkbox is in the disabled state. Here's a pic, I lightened the checkmark in the disabled checkbox using paint to show what I would like. This will make it easier for the user to know the checkbox is disabled.
Hello,
Thank you for your feedback. I am glad that you have managed to resolve your issue.
Never mind, I figured it out. Thanks for your help, I have marked the question answered. For others, I added this to the "cbstyle"
<ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="True"> <Setter TargetName="checkBox" Property="Opacity" Value="1"/> <Setter TargetName="IndeterminateIcon" Property="Opacity" Value="1" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="checkBox" Property="Opacity" Value="0.5"/> <Setter TargetName="IndeterminateIcon" Property="Opacity" Value="0.5" /> </Trigger> </ControlTemplate.Triggers>
hmmm I guess I'd need to also customize the Indeterminate tick mark as well...