Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2370
ComboEditorTool disable item
posted

How can I disable (gray out) specific items in a ComboEditorTool based on a property in my ViewModel?

Thanks,

Jon

  • 17475
    Verified Answer
    Offline posted

    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.

    XamRibbonComboToolDisable.zip