Hi I am trying to have a MenuItem.Icon set thru a style setter:
<Style x:Key="MenuItem_Delete" TargetType="MenuItem"
BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="_Delete"/>
<Setter Property="MenuItem.Icon">
<Setter.Value>
<Image Source="Resources/Delete.png"/>
</Setter.Value>
</Setter>
</Style>
I get the following exception at runtime: Cannot add content of type 'System.Windows.Controls.Image' to an object of type 'System.Object'. Error at object 'System.Windows.Controls.Image' in markup file 'WpfApplication1;component/application.xaml' Line 164 Position 26.
In the other hand, this is the example in the above link:
<MenuItem Header="New">
<MenuItem.Icon>
<Image Source="data/cat.png"/>
</MenuItem.Icon>
</MenuItem>
Thanks.