我使用Xamarin並使用XAML創建了我的視圖,但我無法爲我的生活獲取此標籤以便按照我希望的方式進行包裝。如果標籤獲取到屏幕的邊緣,我想包這樣的... ...使用StackLayout進行標籤封裝
現在它正在尋找這樣的...
這裏是我的代碼:
<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>
這不需要在一個網格中,這只是我現在正在嘗試的方法。我唯一的要求是'認證委員會'是一個標籤,並且我必須傳遞一個值,當它到達屏幕的末尾時,這個值將被換行。任何幫助將是真棒,謝謝!
有你有一個網格,嵌在StackLayout什麼特別的原因,然後嵌入了一個StackLayout?如果不是,請將所有StackLayouts排成一行,在Grid中放置兩列,Column Width Width Auto,Column 1 Width *以及各自列中的2個標籤,並在您的「認證板」 –