gpt4 book ai didi

c# - SplitView.PaneClosed 事件可用但不适用于 PaneOpened

转载 作者:行者123 更新时间:2023-11-30 13:45:14 26 4
gpt4 key购买 nike

根据https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.splitview.paneclosed.aspx SplitView 控件没有 PaneOpened 事件,只有存在的 SplitView 控件的 PaneClosed 事件。

我在 SplitView Pane 中有一个 Button 控件,它需要根据 Pane 是打开还是关闭来更改大小。所以我的计划是我将放置一段代码,在 PaneOpened 事件中将按钮大小更改得更宽,然后在 PaneClosed 事件中将其恢复为小尺寸。但似乎没有 PaneOpened 事件。

还有其他方法可以实现吗?

最佳答案

感谢新的 RegisterPropertyChangedCallback在 UWP 中,您现在可以监视任何 DependencyProperty 的属性更改事件,包括原生的。

public SplitViewPage()
{
this.InitializeComponent();

this.splitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, IsPaneOpenPropertyChanged);
}

private void IsPaneOpenPropertyChanged(DependencyObject sender, DependencyProperty dp)
{
// put your logic here
}

关于c# - SplitView.PaneClosed 事件可用但不适用于 PaneOpened,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31636440/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com