开发者

WP7 PivotItem switch index

I need to switch Pivots in cs code, It works with manual indexes:

MyPivot.SelectedIndex = 3;  

But something like this will be much better for me:

开发者_开发百科MyPivot.SelectedIndex = targetPivotItem.Index; 

but I couldn't found any property for that...


This is if you are not using ItemsSource on your Pivot.

Pivot1.SelectedIndex = Pivot1.Items.IndexOf(PivotItem1);

If you have set your Pivot's ItemsSource to a collection, use following code:

Pivot1.SelectedItem = PivotItem1.DataContext;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜