【发布时间】:2018-02-18 13:08:33
【问题描述】:
我的 listview.Itemtemplate 有问题
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<RelativePanel HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" Margin="0,5">
<TextBlock Margin="5,0,0,0" x:Name="nameTxt" TextWrapping="Wrap" Text="{Binding Name}" FontSize="28"/>
<TextBlock Margin="5,0,0,0" x:Name="IDtxt" TextWrapping="Wrap" Text="ID: " FontSize="12" RelativePanel.Below="nameTxt" FontWeight="Bold"/>
<TextBlock x:Name="IDCode" TextWrapping="Wrap" Text="{Binding IDCode}" FontSize="12" RelativePanel.RightOf="IDtxt" RelativePanel.Below="nameTxt"/>
<TextBlock x:Name="Stato" TextWrapping="Wrap" Text="Stato: " FontSize="20" VerticalAlignment="Center" RelativePanel.AlignRightWithPanel="True"/>
</RelativePanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
我必须将最后一个 textBlock <TextBlock x:Name="Stato"/> 对齐到列表视图的右边缘,但 RelativePanel 似乎在内容的末尾结束并且没有填充网格。
【问题讨论】: