San*_*dji 3 c# xaml windows-10 uwp uwp-xaml
根据https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.splitview.paneclosed.aspx,没有用于SplitView控件的PaneOpened事件,只有PaneClosed事件为存在的SplitView控件.
我在SplitView窗格中有一个Button控件,需要根据窗格是打开还是关闭来改变大小.所以我的计划是,我将放置一段代码,在PaneOpened事件中更改按钮大小,并在PaneClosed事件中将其恢复为小尺寸.但似乎没有PaneOpened事件.
我可以通过其他方式实现这一目标吗?
由于UWP中的新RegisterPropertyChangedCallback,您现在可以监视任何属性更改事件DependencyProperty,包括本机属性更改事件.
public SplitViewPage()
{
this.InitializeComponent();
this.splitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, IsPaneOpenPropertyChanged);
}
private void IsPaneOpenPropertyChanged(DependencyObject sender, DependencyProperty dp)
{
// put your logic here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1067 次 |
| 最近记录: |