SplitView.PaneClosed事件可用,但不适用于PaneOpened [英] SplitView.PaneClosed event is available but not for PaneOpened

查看:34
本文介绍了SplitView.PaneClosed事件可用,但不适用于PaneOpened的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

According to the https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.splitview.paneclosed.aspx there is no PaneOpened event for the SplitView control, only PaneClosed event for the SplitView control that exists.

我在SplitView窗格中有一个Button控件,该控件需要根据窗格是打开还是关闭来改变大小.因此,我的计划是放置一段代码,以在PaneOpened事件中将按钮的大小更改为更宽,然后在PaneClosed事件中将其恢复为较小的大小.但是似乎没有PaneOpened事件.

I have a Button control inside a SplitView pane that needs to change in size according whether the pane is opened or closed. So my plan is I will place a piece of code that will change the button size wider in the PaneOpened event, and restore it back to the small size in PaneClosed event. But it seems there is no PaneOpened event.

还有其他方法可以实现这一目标吗?

Any other way that I can achieve this?

推荐答案

感谢新的

Thanks to the new RegisterPropertyChangedCallback in UWP, you can now monitor property change events of any DependencyProperty, including native ones.

public SplitViewPage()
{
    this.InitializeComponent();

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

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

这篇关于SplitView.PaneClosed事件可用,但不适用于PaneOpened的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆