0

我想在 gridview 项目中使用背景图像。

我试过这个:

< <GridView x:Name="mainGrid" Margin="24.079,143,461.133,-533.627" SelectionChanged="gridSelection" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Height="530.627" VerticalAlignment="Top" Background="White" Grid.Column="1" >
            <GridView.ItemContainerTransitions>

                <TransitionCollection>

                    <EntranceThemeTransition />

                    <RepositionThemeTransition />
                    <ContentThemeTransition HorizontalOffset="200"/>

                </TransitionCollection>

            </GridView.ItemContainerTransitions>
            <GridView.RenderTransform>
                <CompositeTransform SkewX="0.186" TranslateX="0.743"/>
            </GridView.RenderTransform>
            <GridViewItem Width="250" Height="250" Style="{StaticResource gridBackground}"  ScrollViewer.HorizontalScrollBarVisibility="Visible" Margin="0"   >

            </GridViewItem>

            <GridViewItem Width="250" Height="250" Content="Send a test" Margin="0" Background="#FF3988BF"  />
            <GridViewItem Width="250" Height="250" Content="Edit a Newsletter" Background="#FF3988BF"  />
            <GridViewItem Width="250" Height="250" Content="Lists Contacts" Margin="0" Background="#FF3988BF"  />
            <GridViewItem Width="250" Height="250" Content="Images" Background="#FF3988BF"  />
            <GridViewItem Width="250" Height="250" Content="Send to Mailinglist" Background="#FF3988BF"  />




        </GridView>   >

这种风格:

<Style TargetType="GridViewItem" x:Key="gridBackground">
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="../Assets/create.png"/>
            </Setter.Value>
        </Setter>
    </Style>

问题是图像没有显示为网格视图项。我应该怎么办?

4

0 回答 0