xaml - 使用 StackLayout 进行标签包装

标签 xaml xamarin label word-wrap

我正在使用 Xamarin 并使用 XAML 创建我的 View ,但我一生都无法让这个标签按照我想要的方式包装。如果标签到达屏幕边缘,我希望它像这样包裹......

This is the way I want it to look

现在它看起来像这样......

This is how it is showing up

这是我的代码:

<StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" BindingContext="{Binding CurrentProviderDetails}" Padding="20,20,20,20" >
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
<!--Certification Board-->
  <StackLayout Orientation="Horizontal" HorizontalOptions="StartAndExpand" Grid.Row="0" Grid.Column="0" >
    <Label Text="Certification Board: " FontSize="13" HorizontalOptions="Fill" VerticalOptions="CenterAndExpand" />
    <Label Text="{Binding Certification}" VerticalOptions="CenterAndExpand"  HorizontalOptions="Center" Font="17" LineBreakMode="WordWrap"/>
  </StackLayout>
 </Grid>
</StackLayout>

这不需要在网格中;这只是我现在尝试的方法。我唯一的要求是“认证委员会”是一个标签,当它到达屏幕末尾时,我必须传入一个自动换行的值。任何帮助都会很棒,谢谢!

最佳答案

在标签中放置 LineBreakMode="NoWrap"标签。这样你就可以避免包裹。

但是如果你没有足够的空间,这个词就会被剪掉。

关于xaml - 使用 StackLayout 进行标签包装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33155724/

相关文章:

html - 为什么 HTML 元素(input、textarea 和 select)应该有关联的标签?

c# - Windows 8 Metro 风格列表框

Xamarin Forms Android OnAppearing 在 PopModalAsync 后不触发

c# - Windows 8 Metro RichTextColumns 嵌入超链接和图像

android - 如何将SKCanvasView与同一页面中的其他 View 结合起来?

c# - 如何从 C# Xamarin 中的 HTTP post 获取数据?

kubernetes - 如何在 Prometheus-operator 上重新标记抓取作业?

Swift - 在扩展函数中呈现 UIAlertController

silverlight - XAML 转到绑定(bind)定义的 VisualState

c# - 如何在 wpf 中的文本绑定(bind)前面添加项目符号?