How can I disable (gray out) specific items in a ComboEditorTool based on a property in my ViewModel?
Thanks,
Jon
Hello Jon and thank you for posting!
ComboEditorTool’s dropdown consists of items of type ComboBoxItem and a style could be set for those that modifies the IsEnabled property with a DataTrigger.
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="IsEnabled" Value="True"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsItemEnabled}" Value="false">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
I have attached a sample project where the IsEnabled is set to “False” if the IsItemEnabled property of the data source is false for that item.
Please do not hesitate to let me know if you have any other questions.