网格视图项目演示者

时间:2015-07-20 03:08:19

标签: xaml windows-phone-8.1 windows-8.1 winrt-xaml windows-10

如何指定网格视图项目演示者?

(ScreenShot)我想我可以改变GridViewItemsPresenter的HorizantalContentAlignment。

<GridView.ItemTemplate>
  <DataTemplate x:DataType="local:mymodel">
   <StackPanel BorderThickness="4,0,0,0" BorderBrush="{x:Bind Color}"Padding="4,0,0,0" Margin="0,2" HorizontalAlignment="Left">
   <TextBlock Text="{x:Bind Name}" Style="{ThemeResource BodyTextBlockStyle}" HorizontalAlignment="Left"/>
   <TextBlock Text="{x:Bind Date}" Style="{ThemeResource BodyTextBlockStyle}"/>
   <TextBlock Text="{x:Bind Type}" Style="{ThemeResource BodyTextBlockStyle}"/>
   <TextBlock Text="{x:Bind Dls}" Style="{ThemeResource BodyTextBlockStyle}"/>
  </StackPanel>
 </DataTemplate>
</GridView.ItemTemplate>

auto alignment

1 个答案:

答案 0 :(得分:2)

这个怎么样

<GridView.ItemContainerStyle>
    <Style TargetType="GridViewItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>
</GridView.ItemContainerStyle>