I am trying to disable the swipe on a Pivot Control. Looking around on here and Google, it would seem that using the IsLocked property is the way to go. The problem I am getting is that if I set the property to True in the xaml then all the other PivotItem headers disappear.
Now I think I can still work with this but if I then set the IsLocked to false, change the PivotControl. SelectedIndex to say 1, wait for the LoadedPivotItem event to fire and then set IsLocked to true again the header disappears again.
Here is the code.
Note: PagePivot is a 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;
}
As I say, everything above works but as soon as I set the IsLocked = true
, the headers disappear.
I did look into setting IsHitTestVisable
to false
but then none of the controls in the pivot items work.
Screenshots:
1. On First Load, PivotControl Is locked, First item header showing.
2. Changed Selected Item, PivotControl Is locked after item has loaded.