1

对于我的 WPF 应用程序,我正在尝试在 WPF 中获取 Windows 8 Metro Gridview 样式。这是我的 Metro 风格 Gridview 设计的示例代码:

<DataTemplate x:Key="DashboardItemTemplate">
    <Grid HorizontalAlignment="Left" Width="600" Height="120">
        <Border BorderThickness="0" Background="#4B0F03">
            <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
        </Border>
        <StackPanel VerticalAlignment="Bottom" Background="#000000">
            <TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}"     Height="70" Margin="15,0,15,0"/>
            <TextBlock Text="" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
        </StackPanel>
    </Grid>
</DataTemplate>

<GridView
        x:Name="itemGridView"
        AutomationProperties.AutomationId="ItemsGridView"
        AutomationProperties.Name="Items"
        TabIndex="1"
        Grid.RowSpan="2"
        Padding="116,136,116,46"
        ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
        ItemTemplate="{StaticResource DashboardItemTemplate}"
        SelectionMode="None"
        IsSwipeEnabled="false"
        IsItemClickEnabled="True"
        ItemClick="ItemView_ItemClick"/>

但是我没有在 WPF Gridview 中绑定 DataTemplate 的任何选项,是否有任何选项可用于在 WPF 应用程序中将 Gridview 与 DataTemplate 绑定?或任何其他获取 WPF Gridview 的方式,如 Windows 8 Gridview 样式。

4

0 回答 0