5

Windows Phone の開発は初めてです。

リストボックスにデータを表示しています。リスト ボックスのすべての行の背景色は同じです。しかし、リスト ボックスの項目に交互の行に 2 つの異なる色を追加したいと考えています。

以下はリストビューのコードです。

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,10,0,0" Background="White">
        <ListBox Margin="6,6,-6,6" Name="itemslb" SelectionChanged="itemList_SelectionChanged">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid x:Name="listItem">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="100"/>
                            <RowDefinition Height="10"/>
                        </Grid.RowDefinitions>

                        <StackPanel Grid.Row="0" Orientation="Horizontal" Height="100" Margin="0,10,0,0">
                              <StackPanel Width="85" Height="100" >
                                    <StackPanel.Background>
                                        <ImageBrush x:Name="defImage" ImageSource="/DailyFeeds;component/Images/default.png" Stretch="None"></ImageBrush>
                                    </StackPanel.Background>
                                        <Image  Source="{Binding ImageUrl}" VerticalAlignment="Top" Height="90" Width="85" Margin="0,0,10,0" Stretch="Fill" />
                              </StackPanel>
                              <StackPanel Width="370">
                                    <TextBlock Text="{Binding Title}" Foreground="SlateBlue" FontSize="25" TextWrapping="Wrap" />
                                    <TextBlock Text="{Binding Date}" Foreground="#FFC8AB14" FontSize="20"/>                               
                              </StackPanel>                                
                        </StackPanel>

                           <Image  x:Name="line" Grid.Row="1" Width="460" HorizontalAlignment="Center" Margin="0,5,0,0" Source="/DailyFeeds;component/Images/separator.png" />
                    </Grid>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

どうすればそれができますか。

ありがとう

4

3 に答える 3