I am trying to bind a dynamically generated menu. I have set up the following style:
<
Style
x:Key
=
"MenuItemStyle"
TargetType
=
"telerik:RadMenuItem"
>
<
Setter
Property
=
"Header"
Value
=
"{Binding Header}"
/>
<
Setter
Property
=
"IsCheckable"
Value
=
"{Binding IsCheckable}"
/>
<
Setter
Property
=
"IsSeparator"
Value
=
"{Binding IsSeparator}"
/>
<
Setter
Property
=
"IsChecked"
Value
=
"{Binding IsChecked}"
/>
<
Setter
Property
=
"Icon"
Value
=
"{Binding IconUrl}"
/>
<
Setter
Property
=
"ItemsSource"
Value
=
"{Binding SubMenuItems}"
/>
<
Setter
Property
=
"Command"
Value
=
"{Binding MenuItemClicked}"
/>
<
Setter
Property
=
"CommandParameter"
Value
=
"{Binding RelativeSource={RelativeSource Self}}"
/>
<
Setter
Property
=
"IconTemplate"
>
<
Setter.Value
>
<
DataTemplate
>
<
Image
Source
=
"{Binding}"
Stretch
=
"Fill"
/>
</
DataTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Window.Resources
>
This Generates the menus just fine and they appear exactly as I expect HOWEVER the command does nothing ()i.e. the MENUCLICKED. I have set up the command MenuItemClicked in the ViewModel and correct instantiated it as an ICOMMAND but it never fires the command. What am I missing??. The command is set up as follows:
public ICommand MenuItemClicked { get; set; }
MenuItemClicked = new Command<
RadMenuItem
>(c =>
{
....executesomeciodec);
});
I must have missed something but for the life of me I cannot see what. I know it is bound correctly as the menus are getting populated with the correct properties, icons and layouts.
Please advise - thank you