如何在WP7中隐藏/取消隐藏枢纽项目 [英] How to hide/ unhide a pivot item in WP7
问题描述
我有一个包含4个枢轴项目的应用程序.在枢轴项目2中进行特定选择时,我将不得不隐藏枢轴项目3.在枢纽项目4中做出另一个选择时,我将不得不取消隐藏枢纽项目3,但其位置应在item2与 仅限item4.
I have an application with 4 pivot items. On making a particular selection in pivot item2, i will have to hide the pivot item3. On making another selection in pivot item4, i will have to unhide the pivot item3, but its position should be between item2 and item4 only.
我尝试添加和删除,但我只能在末尾而不是在item2和item4之间添加数据透视项.
I tried adding and removing but i was only able to add the pivot item at the end and not in between item2 and item4.
我的问题有解决方案吗?
Is there any solution for my problem?
推荐答案
这两个按钮单击处理程序将在索引处插入/删除PivotItem. = 1;
These two button click handlers will do insert/remove PivotItem at index = 1;
但是我认为这不是最好的主意.
But I think this is not the best idea to do it.
private PivotItem savedPivotItem = null;
private void RemoveSecondPivotItem_Click(object sender, RoutedEventArgs e)
{
savedPivotItem = MainPivot.Items[1] as PivotItem;
MainPivot.Items.RemoveAt(1);
}
private void AddSecondPivotItem_Click(object sender, RoutedEventArgs e)
{
if (savedPivotItem != null)
{
MainPivot.Items.Insert(1, savedPivotItem);
}
}
此致.
这篇关于如何在WP7中隐藏/取消隐藏枢纽项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!