(视窗10 UWP)SplitView.PaneClosed事件是有的,但不是PaneOpened [英] (Windows 10 UWP) SplitView.PaneClosed event is available but not for PaneOpened
问题描述
据的的 https://msdn.microsoft.com/en-us/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窗格内的按钮控制。所以,我的计划是,我会放置一段代码,这将改变按钮的大小更广泛的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?
推荐答案
由于新 RegisterPropertyChangedCallback 在UWP,你现在可以监控属性更改事件的的DependencyProperty
,包括本地的。
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
}
这篇关于(视窗10 UWP)SplitView.PaneClosed事件是有的,但不是PaneOpened的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!