我正在使用C#启用panoramaItem的可见性。默认情况下,panoramaItem设置为Collapsed。见下文:
<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没有显示。
答案 0 :(得分:1)
试试这个:
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;
}