ericlee
ericlee

Reputation: 2753

WP7, navigiating between each item in a pivot page

Right now i am trying to navigate between two of the item in a pivot page. may i know if a event handler for this exits?

Upvotes: 0

Views: 780

Answers (2)

Santhu
Santhu

Reputation: 1525

Pivot Control has the SelectionChanged event, please use this and add the Handler in .xaml file.

like..

 <controls:Pivot Name= "SamplesPivot" SelectionChanged="SamplesPivot_SelectionChanged">
    <controls: PivotItem = "One" >
      <Grid>
      </Grid>
    </controls:PivotItem>
    <controls: PivotItem = "Two" >
      <Grid>
      </Grid>
    </controls:PivotItem>
 </controls:Pivot>

In Handler function (in .xaml.cs file) add use the PivotControl's SelectedIndex index and determine the new Item selected, and do the operation accordingly.

as like..

private void SamplesPivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (SamplesPivot.SelectedIndex == 1)
    {
       //First item is selected.
    }
}

Upvotes: 3

Ku6opr
Ku6opr

Reputation: 8126

Pivot has an SelectionChanged event handler for this

Upvotes: 0

Related Questions