使用IsLocked属性禁用在数据透视表控件上滑动隐藏了数据透视表标题

Gaz*_*z83 0 c# wpf xaml windows-phone-8

我试图禁用数据透视控件上的滑动.环顾这里和谷歌,似乎使用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 = true;
}
Run Code Online (Sandbox Code Playgroud)

正如我所说,上面的一切都有效,但是一旦我设置IsLocked = true,标题就会消失.我确实调查了设置IsHitTestVisable,false但是枢轴项中的控件都没有工作.

截图:

1.在第一次加载时,PivotControl被锁定,显示第一项标题.
2.更改了所选项目,PivotControl在项目加载后被锁定.

dnx*_*xit 6

对于UWP,我要覆盖枢轴样式,并且有一个元素数据透视面板,所以如果我们禁用ManipulationMode =无滑动将被禁用,它将更像标签.

<PivotPanel x:Name="Panel" VerticalAlignment="Stretch" ManipulationMode="None">
Run Code Online (Sandbox Code Playgroud)