我试图禁用数据透视控件上的滑动.环顾这里和谷歌,似乎使用IsLocked属性是要走的路.我得到的问题是,如果我在xaml中将属性设置为True,那么所有其他PivotItem标头都会消失.
现在我想我仍然可以使用它但是如果我然后将IsLocked设置为false,则更改PivotControl.SelectedIndex说1,等待LoadedPivotItem事件触发,然后再将IsLocked设置为true,标题再次消失.
这是代码.
注意:PagePivot是一个PivotControl
private void appbarNext_Click(object sender, System.EventArgs e)
{
// Unlock the PivotControl
PagePivot.IsLocked = false;
// If we are at the first item then move to the next - (just testing everything out)
if(PagePivot.SelectedIndex == 0)
{
PagePivot.SelectedIndex = 1;
}
}
private void PagePivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
{
// Relock the PivotControl - this causes the headers to disappear again
PagePivot.IsLocked = …Run Code Online (Sandbox Code Playgroud)