Hi,
I templated the way items shows up in a menu, but, for an unknown reason, I am having trouble displaying the whole text in the MenuItem. Here is a screen capture of the problem:
Here is the markup code I used to template it:
<ItemsPanelTemplate x:Key="SideBarItemsPanelTemplate">
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
<DataTemplate x:Key="SideBarItemTemplate">
<MenuItem Command="{Binding}" Header="{Binding Text}" Background="AliceBlue">
<MenuItem.Icon>
<Image Width="16" Height="16" Source="{Binding Image}"/>
</MenuItem.Icon>
</MenuItem>
</DataTemplate>
<Style x:Key="SideBarStyle" TargetType="{x:Type Menu}">
<Setter Property="ItemTemplate" Value="{StaticResource SideBarItemTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource SideBarItemsPanelTemplate}"/>
<Setter Property="Background" Value="White"/>
</Style>
And to display it:
<Menu ItemsSource="{Binding Commands}" Style="{StaticResource SideBarStyle}"/>
I searched a lot, but nothing helped solving this issue. Hope I will find some help here.
Thanks.