开发者

WP7 PivotItem switch index

开发者 https://www.devze.com 2023-02-01 06:07 出处:网络
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:

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

精彩评论

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

关注公众号