【问题标题】:unable to set labelPosition in commandbar and appbarbuttons无法在命令栏和 appbarbuttons 中设置 labelPosition
【发布时间】:2016-06-25 15:57:24
【问题描述】:

我正在编写一个 UWP 应用。我想在应用中使用图标和标签。所以我创建了一个CommandBar 并将AppBarButton 放入其中。但问题是没有CommandBarDefaultLabelPosition 属性可用。 AppBarButtonLabelPosition 属性均不可用。然后我尝试将AppBarButton 放入StackPanelGrid。但AppBarButton 仍将Label 放在Icon 下方。我想将Label 放在Icon 的右侧。如何将Label 放在Icon 的右侧?我一般搜索了互联网和stackoverflow,但没有得到任何答案。我没有提供任何代码,因为这根本不适用于只有一个 CommandBar 的新项目。 MSDN 文档引用了DefautltLabelPositon 属性,但Intellisence 没有。我更愿意在GridStackPanel 中使用AppBarButtons 而不是CommandBar。我正在使用默认的Min VersionTarget Version 处理Visual studio 2015 update 2

【问题讨论】:

    标签: uwp uwp-xaml


    【解决方案1】:

    其实我也看过那篇文章。直到现在我还没有给它太多的关注。正如你所说,它似乎真的没有那个属性。但是我可以重新定位这个标签。这是我的项目中的一个示例:

    <CommandBar>
        <AppBarToggleButton>
            <StackPanel Orientation="Horizontal">
                <SymbolIcon Symbol="Add" />
                <TextBlock Text="Add" />
            </StackPanel>
        </AppBarToggleButton>
        <AppBarToggleButton Icon="RepeatAll" Label="Repeat" />
    </CommandBar>
    

    希望这会有所帮助。

    【讨论】:

    • 是的,这是我最后应用的解决方法。谢谢
    【解决方案2】:

    有点晚了,但DefaultLabelPosition 属性需要 Windows 10 版本 1607(内部版本 14393)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多