【问题标题】:How to better handle long item names in CommandBar如何更好地处理 CommandBar 中的长项目名称
【发布时间】:2020-06-05 18:22:53
【问题描述】:

有没有比默认更好的方法来处理具有长文本的CommandBar 项目。字符长度因语言而异,因此有时可能无法看到项目文本是什么,因为 CommandBar 在展开时会发生变化。

XAML(法语)

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <CommandBar Grid.Row="0">
        <CommandBar.Content>
            <Button 
                Style="{StaticResource NavigationBackButtonNormalStyle}" 
                Name="BackButton" 
                VerticalAlignment="Top" 
                Click="Back_Click"/>
        </CommandBar.Content>

        <AppBarButton Icon="Mail" Label="Information sur le produit"/>
        <AppBarButton Icon="Mail" Label="Avis sur les produits"/>
        <AppBarButton Icon="Mail" Label="Informations de contact"/>
    </CommandBar>
    <Frame Name="MyFrame" Grid.Row="1"/>
</Grid>

XAML(英语)

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <CommandBar Grid.Row="0">
        <CommandBar.Content>
            <Button 
                Style="{StaticResource NavigationBackButtonNormalStyle}" 
                Name="BackButton" 
                VerticalAlignment="Top" 
                Click="Back_Click"/>
        </CommandBar.Content>

        <AppBarButton Icon="Mail" Label="Product information"/>
        <AppBarButton Icon="Mail" Label="Product reviews"/>
        <AppBarButton Icon="Mail" Label="Contact information"/>
    </CommandBar>
    <Frame Name="MyFrame" Grid.Row="1"/>
</Grid>

英语(折叠)

英语(扩展)

法语(已折叠)

法语(扩展)

【问题讨论】:

    标签: windows xaml uwp uwp-xaml


    【解决方案1】:

    有没有比默认更好的方法来处理长文本的 CommandBar 项目。

    CommandBar 的内容不要太长,如果你确实想制作长的内容,可以将DefaultLabelPosition 设置为正确。

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    
        <CommandBar Grid.Row="0" DefaultLabelPosition="Right">
            <CommandBar.Content>
                <Button 
                Style="{StaticResource NavigationBackButtonNormalStyle}" 
                Name="BackButton" 
                VerticalAlignment="Top" 
                Click="Back_Click"/>
            </CommandBar.Content>
    
            <AppBarButton Icon="Mail" Label="Information sur le produit" />
            <AppBarButton Icon="Mail" Label="Avis sur les produits"/>
            <AppBarButton Icon="Mail" Label="Informations de contact"/>
        </CommandBar>
        <Frame Name="MyFrame" Grid.Row="1"/>
    </Grid>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-28
      • 2017-12-23
      • 1970-01-01
      • 2018-09-02
      • 2023-03-14
      • 2011-06-18
      • 2011-06-24
      • 1970-01-01
      相关资源
      最近更新 更多