Uno NavigationBar标签不显示及图标尺寸过小问题求助
1. 让PrimaryCommands按钮显示Label
默认情况下,NavigationBar的PrimaryCommands区域按钮处于紧凑模式,仅显示图标。要显示Label,有两种方式:
- 全局设置NavigationBar的显示模式为展开状态:
<utu:NavigationBar x:Name="navBar" Background="{StaticResource NavigatorBkgColor}" Content="{Binding Title, Mode=TwoWay}" MainCommandMode="Action" DisplayMode="Expanded"> <!-- 原有PrimaryCommands和SecondaryCommands代码 --> </utu:NavigationBar> - 针对单个按钮取消紧凑模式:
<AppBarButton Label="Locations" uen:Navigation.Request="Locations" Foreground="White" IsCompact="False"> <!-- 图标代码 --> </AppBarButton>
2. 调整图标尺寸
直接在BitmapIcon上指定宽高属性即可放大图标,根据需求设置合适数值:
<BitmapIcon UriSource="ms-appx:///Project/Assets/Icons/location_chip.png" Width="32" Height="32"/>
如果需要统一调整所有导航栏图标的大小,也可以通过自定义样式实现:
<Style TargetType="AppBarButton"> <Setter Property="IconWidth" Value="32"/> <Setter Property="IconHeight" Value="32"/> </Style>
内容的提问来源于stack exchange,提问作者Robotuner
相关产品推荐
相关产品推荐

