Hi,
I tried the following code and the dropDown disappeared on each click of MenuItems, in v2.4, v2.9 and up.
I tried the following code and the dropDown disappeared on each click of MenuItems, in v2.4, v2.9 and up.
<Window x:Class="WpfApplication93.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication93"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="MainWindow">
<Grid>
<xctk:SplitButton x:Name="MyButton"
Width="300"
Height="50"
Content="AddThing">
<xctk:SplitButton.DropDownContent>
<ItemsControl HorizontalAlignment="Left">
<ItemsControl.Resources>
<Style TargetType="MenuItem">
<Setter Property="StaysOpenOnClick"
Value="False" />
</Style>
</ItemsControl.Resources>
<MenuItem Click="OnClickOne"
Header="AddThing" />
<MenuItem Click="OnClickTwo"
Header="AddOtherThing" />
</ItemsControl>
</xctk:SplitButton.DropDownContent>
</xctk:SplitButton>
</Grid>
</Window>namespace WpfApplication93
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void OnClickOne( object sender, RoutedEventArgs e )
{
MyButton.IsOpen = false;
}
private void OnClickTwo( object sender, RoutedEventArgs e )
{
MyButton.IsOpen = false;
}
}
}