
Hello,
How to change PopupButton.StayOpen in PopupButtonContent?
I have checked with the following source code.
After I ticked StayOpenCheckBox, PopupButton.StayOpen = true is not reflected immediately.
--> Popup will be closed when click outside of PopupContent.
Xaml:
<Window
x:Class="PopupSample.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:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
Title="MainWindow"
mc:Ignorable="d">
<Grid>
<shared:PopupButton
x:Name="MyPopupButton"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Popup Button">
<shared:PopupButton.PopupContent>
<CheckBox
x:Name="StayOpenCheckBox"
Margin="8"
Checked="OnStayOpenCheckBoxCheckedChanged"
Content="StayOpen"
Unchecked="OnStayOpenCheckBoxCheckedChanged" />
</shared:PopupButton.PopupContent>
</shared:PopupButton>
</Grid>
</Window>
Code behind:
using System.Windows;
namespace PopupSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void OnStayOpenCheckBoxCheckedChanged(object sender, RoutedEventArgs e)
{
MyPopupButton.StaysOpen = StayOpenCheckBox.IsChecked == true;
}
}
}