0

I want to display a list of available languages in a menu. The languages are available as an ICollectionView.

This is the code:

<Menu DockPanel.Dock="Top">
 <Menu.Resources>
  <Style x:Key="LanguageMenuStyle" TargetType="MenuItem">
   <Setter Property="Header" Value="{Binding Name}"></Setter>
   <Setter Property="IsCheckable" Value="True"/>
  </Style>
 </Menu.Resources>
 <MenuItem Header="Language" ItemsSource="{Binding Languages}"
              ItemContainerStyle="{StaticResource LanguageMenuStyle}">
 </MenuItem>
</Menu>

Languages is an ICollectionView created as default view from a list of cultures. The menu is displayed correctly. Now I would like to bind to the CurrentChanged event when the selection in the menu changes, but since there is no IsSynchronizedWithCurrentItem property, how could I do that?

And is there a way to allow only one item to be checked at a time?

H.B.
  • 166,899
  • 29
  • 327
  • 400
tabina
  • 1,095
  • 1
  • 14
  • 37
  • I couldn't get your first question. what's the purpose – HichemSeeSharp Aug 18 '12 at 13:39
  • I want to switch the current culture at runtime. Therefore I want to display a list of available cultures in the menu bar at the top of my window. I would like to have menu item called "Languages" and if you click on it, the available cultures should be displayed in a drop down menu. Only one culture at a time should be selectable. – tabina Aug 30 '12 at 12:08

0 Answers0