Context Menu of WPF ListView

When an user interface contain too many buttons, a user cannot comfort to handle this and i think it is not a good design.For this reason i try to remove some button which button actually need for editing,deleting operation for Listview.In this situation The Context Menu is the perfect solution.
here is the XAML Code

<ListView BorderBrush="#FFA8CC7B" Height="133" HorizontalAlignment="Left" Margin="88,382,0,0" Name="lvInvDetails" VerticalAlignment="Top" Width="596">
                <ContextMenu Name="InvoiceDetailsList" StaysOpen="true" Background="WhiteSmoke">
                    <MenuItem Header="Edit" Name="EditIVD" Click="EditIVD_Click" />
                    <MenuItem Header="Remove" Name="RemoveIVD" Click="RemoveIVD_Click" />
                    <GridViewColumn DisplayMemberBinding="{Binding Path=InvoiceDetailsItemId}" Header="Item Id" Width="90" />
                    <GridViewColumn DisplayMemberBinding="{Binding Path=InvoiceDetailsItemName}" Header="Item Name" Width="120" />

If you have any query about this topic please leave a comment.


3 Responses to “Context Menu of WPF ListView”

  1. Nabab Says:

    helpful site

  2. Angelo Riganis Says:

    Very helpful entry, but it would be interesting to know how to make the context menu appear when right-clicking an item of the list only.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: