This question is locked. New answers and comments are not allowed.
Hi,
I have a contextmenu in the header of a gridview, then inside the menuitem there's a checkbox wherein when selected it will call the command but it's not firing. I'm not sure if I have to include the AncestorLevel or use PlacementTarget.
VIEW
ViewModel
Thanks,
Cielo
I have a contextmenu in the header of a gridview, then inside the menuitem there's a checkbox wherein when selected it will call the command but it's not firing. I'm not sure if I have to include the AncestorLevel or use PlacementTarget.
VIEW
<
telerik:GridViewDataColumn.Header
>
<
ToggleButton
HorizontalAlignment
=
"Left"
IsChecked
=
"{Binding IsOpen, ElementName=radContextMenuLink, Mode=TwoWay}"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
x:Name
=
"radContextMenuLink"
Placement
=
"Bottom"
>
<
telerik:RadMenuItem
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/Merchandise_Link;component/Images/link-icon.png"
Stretch
=
"Uniform"
/>
</
telerik:RadMenuItem.Icon
>
<
telerik:RadMenuItem.HeaderTemplate
>
<
DataTemplate
>
<
CheckBox
Name
=
"chkHasLink"
Command
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView}, Path=DataContext.HasLinkChangedCommand, Mode=TwoWay}"
CommandParameter
=
"{Binding IsChecked, ElementName=chkHasLink}"
/>
</
DataTemplate
>
</
telerik:RadMenuItem.HeaderTemplate
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/Merchandise_Link;component/Images/link-break-icon.png"
Stretch
=
"Uniform"
/>
</
telerik:RadMenuItem.Icon
>
<
telerik:RadMenuItem.HeaderTemplate
>
<
DataTemplate
>
<
CheckBox
Name
=
"chkNoLink"
Command
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView}, Path=DataContext.HasLinkChangedCommand}"
CommandParameter
=
"{Binding IsChecked, ElementName=chkNoLink}"
/>
</
DataTemplate
>
</
telerik:RadMenuItem.HeaderTemplate
>
</
telerik:RadMenuItem
>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
</
ToggleButton
>
</
telerik:GridViewDataColumn.Header
>
ViewModel
HasLinkChangedCommand =
New
DelegateCommand(Of
Object
)(
AddressOf
subHasLinkChanged)
Private
Sub
subHasLinkChanged(
ByVal
objLink
As
Object
)
'do something here
End
Sub
Thanks,
Cielo