我需要设置网格行的高度。
请见打击是我的网格
<ContentPage.ToolbarItems>
<!--<ToolbarItem Text="Logout" Clicked="OnLogout_Clicked" />-->
</ContentPage.ToolbarItems>
<ContentPage.Content>
<ScrollView>
<StackLayout BackgroundColor="MediumPurple" >
<!--<Button Text="Sign Out" Clicked="Signout_Clicked" FontAttributes="Bold" BackgroundColor="MediumSlateBlue" BorderRadius="5" TextColor="White"></Button>-->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" BackgroundColor="White">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Button Text="All" Clicked="All_Clicked" BackgroundColor="Orange" />
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Button Text="A" Clicked="A_Clicked" BackgroundColor="Orange" />
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Button Text="B" Clicked="B_Clicked" BackgroundColor="Orange"/>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Button Text="C" Clicked="C_Clicked" BackgroundColor="Orange"/>
</StackLayout>
</StackLayout>
<Label Text="msg" VerticalTextAlignment="Center" FontSize="Large" TextColor="White" HorizontalOptions="Center" />
<Label x:Name="lblMsg" TextColor="Red" IsVisible="False" ></Label>
<ListView x:Name="listView" ItemTapped="OnItemSelected" BackgroundColor="MediumPurple" >
<ListView.ItemTemplate >
<DataTemplate >
<ViewCell >
<Grid Padding="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="90" ></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label BackgroundColor="Green" Grid.Row="0" Grid.Column="0" Text="ID" LineBreakMode="TailTruncation" TextColor="Black"></Label>
<Label BackgroundColor="Yellow" Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalTextAlignment="End" Text="Description Text Description Text Description Text Description Text Description Text Description Text " Font="Small" TextColor="Black" LineBreakMode="WordWrap" ></Label>
<Label BackgroundColor="Aquamarine" Grid.Row="0" Grid.Column="1" Text="Date" TextColor="Black"></Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
我需要将高度设置为Description
,因为描述被裁剪了。
如何显示整个说明?
我需要类似上表的内容。
答案 0 :(得分:1)
尝试这个:
<ListView HasUnevenRows="True" x:Name="listView">
<ListView.ItemTemplate >
<DataTemplate >
<ViewCell >
<Grid Padding="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="90" ></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label BackgroundColor="Green" Grid.Row="0" Grid.Column="0" Text="ID" LineBreakMode="TailTruncation" TextColor="Black"></Label>
<Label BackgroundColor="Yellow" Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" Text="Description Text Description Text Description Text Description Text Description Text Description Text " Font="Small" TextColor="Black" LineBreakMode="WordWrap" ></Label>
<Label BackgroundColor="Aquamarine" Grid.Row="0" Grid.Column="1" Text="Date" TextColor="Black"></Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>