Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: Cannot close SplitButton dropdown using IsOpen property.

$
0
0
I have a split button which has a dropdown that contains an ItemsControl that contains menu items, when a menu item is selected it calls a handler, the first thing I do is to attempt to close the dropdown using the following code.
private void OnClickOne(object sender, RoutedEventArgs e) {
  MyButton.IsOpen = false;
  ...
  // Do the work.
  ...
}
The dropdown does not disappear, I checked the value of IsOpen when it enters the handler and it is already set to false. The dropdown only seems to disappear if something else gains focus. Am I missing a style or setting somewhere? I was using an older version of the library but I downloaded 2.9.0 and it exhibits the same behaviour.

The following is an example of the XAML.
<xctk:SplitButtonx:Name="MyButton"Grid.Row="1"Grid.Column="1"Click="OnAdd"Content="AddThing"><xctk:SplitButton.DropDownContent><ItemsControlHorizontalAlignment="Left"><ItemsControl.Resources><StyleTargetType="MenuItem"><SetterProperty="StaysOpenOnClick"Value="False"/></Style></ItemsControl.Resources><MenuItemClick="OnClickOne"Header="AddThing"/><MenuItemClick="OnClickTwo"Header="AddOtherThing"/></ItemsControl></xctk:SplitButton.DropDownContent></xctk:SplitButton>
Any help would be greatly appreciated.

//*eggbox

Viewing all articles
Browse latest Browse all 2157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>