I need to have a context menu on a gridview whereby the user can select multiple rows on the gridview and right-clicked on it then the user can change the Status of the row via the iCommand.
Unfortunately, when the user click on the item context menu the command will trigger an iCommand and CommanParameter is null. The CommandParameter should be the multiple selected rows on the gridview. Is there a way to make this work?
<
telerik:RadGridView
Name
=
"rcGridView"
Grid.Row
=
"0"
Margin
=
"15"
ItemsSource="{Binding Users,
NotifyOnSourceUpdated
=
True
,
UpdateSourceTrigger
=
PropertyChanged
,
Mode
=
TwoWay
}"
AutoGenerateColumns
=
"False"
ClipToBounds
=
"False"
SelectionMode
=
"Extended"
VerticalAlignment
=
"Stretch"
telerik:StyleManager.Theme
=
"Summer"
RowHeight
=
"20"
RowIndicatorVisibility
=
"Collapsed"
CanUserInsertRows
=
"False"
CanUserDeleteRows
=
"False"
HorizontalAlignment
=
"Left"
FontSize
=
"11"
ClipboardCopyMode
=
"All"
ClipboardPasteMode
=
"AllSelectedCells,Default"
SelectionUnit
=
"FullRow"
CanUserFreezeColumns
=
"False"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
>
<
telerik:RadContextMenu.Items
>
<
telerik:RadMenuItem
Header
=
"Approve"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource
FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoApproveCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
<
telerik:RadMenuItem
Header
=
"Hold"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoHoldCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
<
telerik:RadMenuItem
Header
=
"Reject"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoRejectCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
</
telerik:RadContextMenu.Items
>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding ID}"
/>
<
telerik:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
Header
=
"Status"
DataMemberBinding
=
"{Binding Status}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Unfortunately, when the user click on the item context menu the command will trigger an iCommand and CommanParameter is null. The CommandParameter should be the multiple selected rows on the gridview. Is there a way to make this work?