I have two button inside different columns in data grid view in WPF Application. That data grid view will load from DB. At same time , there will be a Location drop down menu item present in each row. I have five columns and the image shows the contents present in the last two column of my wpf application.
Like this
As we can see in the image, the arrow for the drop down is present in the Location. But when I press it, I do not see the sub menuitems as shown in the xaml code below.
<local:CustomListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="Car" Width="Auto"
DisplayMemberBinding="{Binding Car}" />
<GridViewColumn Header="House" Width="Auto"
DisplayMemberBinding="{Binding House}" />
<GridViewColumn Header="" Width="60">
<GridViewColumn.CellTemplate>
<DataTemplate>
<MenuItem Header="Location" ToolTip="Click to see info">
<MenuItem Header="Start" Click="info_Click"
ToolTip="Shows the start route"/>
<MenuItem Header="Final" Click="info_Click"
ToolTip="Show the final route"/>
</MenuItem>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</local:CustomListView.View>
For some reason, I am unable to see the sub-items Start and Final. I am very new to this and would appreciate any help.
Thanks to all.
I am not able to understand how to add the following code section shown below to have a menu item. Is it possible or is there any other approach?
<local:CustomListView.ContextMenu>
<ContextMenu>
</ContextMenu>
</local:CustomListView.ContextMenu>
I want to add something like this in the GridViewColumn.CellTemplate section.
Can someone guide me on how to do this. I have spent hours but with no success.
What I have tried:
The code sections shown above is what I have tried.