Click here to Skip to main content
15,882,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
It does not work off MenuItem in ContextMenu.

Bind it to the ListView. If an element in ListVIew not selected, IsEnabled a MenuItem should be able to false.

     <ContextMenu x:Key="CategoryiesTaskMenu">
         <MenuItem Header="Add Category"/>
            <MenuItem Header="Edit Category">
                    <Style TargetType="{x:Type MenuItem}">
                            <DataTrigger Binding="{Binding ElementName=listView, Path=SelectedIndex}" Value="-1">
                                <Setter Property="IsEnabled" Value="False"/>

<ListView Name="listViewTask" ContextMenu="{DynamicResource CategoryiesTaskMenu}">

1 solution

Well, your element name is ListViewTask, and your trigger is using listView.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900