Hi,
I have a Togglebutton with an Image in a cell that has a Contexmenu that opens when I Left click on tit. That works fine. But I need to set in code "IsEnable" on the MenuItems, but I can't use the MenuItems name, the code cant see / find the element (The name 'menu1' does not exist in the current context).
I used a Togglebutton since I found that to be the easiest way, what I need is an image that will open an ContexMenu on left click.
This How I code in Xaml
/Ken
I have a Togglebutton with an Image in a cell that has a Contexmenu that opens when I Left click on tit. That works fine. But I need to set in code "IsEnable" on the MenuItems, but I can't use the MenuItems name, the code cant see / find the element (The name 'menu1' does not exist in the current context).
I used a Togglebutton since I found that to be the easiest way, what I need is an image that will open an ContexMenu on left click.
This How I code in Xaml
<
telerik:GridViewColumn
Header
=
"Mode"
Width
=
"60"
HeaderTextAlignment
=
"Center"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
ToggleButton
Name
=
"btnMode"
HorizontalAlignment
=
"Center"
IsChecked
=
"{Binding IsOpen, ElementName=menuModes, Mode=TwoWay}"
Tag
=
"{Binding Id}"
Click
=
"btnMode_Click"
>
<
Image
Source
=
"{Binding ModeImage}"
/>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
Name
=
"menuModes"
Placement
=
"Bottom"
>
<
telerik:RadMenuItem
Header
=
"Menu 1"
Tag
=
"{Binding Id}"
Name
=
"menu1"
Click
=
"menu1_Click"
/>
<
telerik:RadMenuItem
Header
=
"Menu 2"
Tag
=
"{Binding Id}"
Name
=
"menu2"
Click
=
"menu2_Click"
/>
<
telerik:RadMenuItem
Header
=
"Menu 3"
Tag
=
"{Binding Id}"
Name
=
"menu3"
Click
=
"menu3_Click"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
</
ToggleButton
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
/Ken