C# 如何在windows phone的不同中心部分隐藏应用程序栏按钮?
我是C#的新手。当我在小节中移动时,应用程序栏保持不变,只有在第三小节中一个按钮被隐藏 HubPage.xamlC# 如何在windows phone的不同中心部分隐藏应用程序栏按钮?,c#,xaml,windows-phone-8.1,C#,Xaml,Windows Phone 8.1,我是C#的新手。当我在小节中移动时,应用程序栏保持不变,只有在第三小节中一个按钮被隐藏 HubPage.xaml <Page.BottomAppBar> <CommandBar x:Name="mybar" ClosedDisplayMode="Minimal" > <CommandBar.SecondaryCommands> <AppBarButton Label="setting" Click="Ap
<Page.BottomAppBar>
<CommandBar x:Name="mybar" ClosedDisplayMode="Minimal" >
<CommandBar.SecondaryCommands>
<AppBarButton Label="setting" Click="AppBarButton_Click"/>
</CommandBar.SecondaryCommands>
<AppBarButton x:Uid="CALENDAR" Label="calendar" Click="AppBarButton_Click">
<AppBarButton.Icon>
<SymbolIcon x:Name="btnCalendar" Symbol="Calendar"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton x:Name="btnLocation" x:Uid="MAP" Icon="MapPin" Label="location" Click="AppBarButton_Click" />
</CommandBar>
</Page.BottomAppBar>
如果我正确理解您的问题,您将Name属性设置在错误的位置。您应该将其设置为
AppBarButton
元素,而不是SymbolIcon
。我认为您的代码应该在这些更改之后工作
CommandBar x:Name="mybar" ClosedDisplayMode="Minimal" >
<CommandBar.SecondaryCommands>
<AppBarButton Label="setting" Click="AppBarButton_Click"/>
</CommandBar.SecondaryCommands>
<AppBarButton x:Uid="CALENDAR" x:Name="btnCalendar" Label="calendar" Click="AppBarButton_Click">
<AppBarButton.Icon>
<SymbolIcon Symbol="Calendar"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton x:Name="btnLocation" x:Uid="MAP" Icon="MapPin" Label="location" Click="AppBarButton_Click" />
</CommandBar>
CommandBar x:Name=“mybar”ClosedDisplayMode=“Minimal”>
CommandBar x:Name="mybar" ClosedDisplayMode="Minimal" >
<CommandBar.SecondaryCommands>
<AppBarButton Label="setting" Click="AppBarButton_Click"/>
</CommandBar.SecondaryCommands>
<AppBarButton x:Uid="CALENDAR" x:Name="btnCalendar" Label="calendar" Click="AppBarButton_Click">
<AppBarButton.Icon>
<SymbolIcon Symbol="Calendar"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton x:Name="btnLocation" x:Uid="MAP" Icon="MapPin" Label="location" Click="AppBarButton_Click" />
</CommandBar>