在Windows Phone 8中使用c#改变PanoramaItem的可见性
本文关键字:改变 PanoramaItem 可见性 Windows Phone | 更新日期: 2023-09-27 18:15:59
我正在使用c#使panoramaItem的可见性可见。默认情况下,panoramaItem被设置为折叠。见下文:
<phone:PanoramaItem Header="select" Visibility="Collapsed" x:Name="SelectGroup">
<TextBlock Text="HI" Margin="30" FontSize="36"></TextBlock>
</phone:PanoramaItem>
现在有一个TextBlock,我已经创建了一个Tap事件:
<TextBlock x:Name="SeachBloodGroup" Text="A+" FontSize="30" Tap="BloodGroup_Tap"></TextBlock>
代码:private void BloodGroup_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
SelectGroup.Visibility = SelectGroup.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
}
但是panoramaItem没有显示
试试这个:
private void BloodGroup_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
if (SelectGroup.Visibility == System.Windows.Visibility.Collapsed)
SelectGroup.Visibility = System.Windows.Visibility.Visible;
else
SelectGroup.Visibility = System.Windows.Visibility.Collapsed;
}