How to lock and unlock Pivot swipe gesture | Techbirds

Hi all,

I am describing how to lock and unlock pivot swipe gesture, for which we have to use LockablePivot control.
Lockable Pivot is suitable in cases when you have multiple selection, sliding, drawing, etc.

To begin with using the LockablePivot first add a reference to the Microsoft.Phone.Controls.Toolkit.dll assembly in your Windows Phone application project.

Define an instance of the LockablePivot control in XAML: you have to add the following namespace declaration:

xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”

xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”

Add pivot control in your page.

    

        

      

LockablePivot is in fact a simple control that derives from Pivot, so it exposes all the properties of the Pivot plus one more additional IsLocked property.

Now add buttons to lock and unlock pivot and on there click event write the following code-

private void btnLock_Click(object sender, RoutedEventArgs e) { this.pivot.IsLocked = true; } private void btnUnLock_Click(object sender, RoutedEventArgs e) { this.pivot.IsLocked = false; }

private void btnLock_Click(object sender, RoutedEventArgs e)

{

    this.pivot.IsLocked = true;

}

private void btnUnLock_Click(object sender, RoutedEventArgs e)

{

    this.pivot.IsLocked = false;

}

For watching the use of locking pivot gesture please watch this video.

1,520 total views, 2 views today

Share this Onfacebook-5335066twitter-8152080linkedin-3546054google-1932671