You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Uno NavigationBar标签不显示及图标尺寸过小问题求助

解决Uno NavigationBar的Label显示与图标尺寸问题

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 00:20:08