我是Windows手机开发的新手.
我在列表框中显示数据.对于列表框中的所有行,背景颜色相同.但我想为备用行添加两种不同的颜色来列出框项目.
下面是列表视图的代码.
<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>
Run Code Online (Sandbox Code Playgroud)
我们怎么做到这一点.
谢谢
我想在窗口电话8中水平对齐的堆叠面板中安排两个组件,一个在左边,另一个在右边.
我需要左对齐的组件应该在页面的左侧,右对齐的组件应该在页面的右侧.这两个组成部分之间应该存在差距.
左对齐组件是静态的,右对齐组件是动态的.对于静态组件,我为动态组件设置了width = auto和剩余空间.
以下是我的代码.
<Border x:Name="DataBorder" Grid.Row="1" BorderBrush="Gray" CornerRadius="5,5,5,5" BorderThickness="2,2,2,2" Margin="10,30,10,10">
<StackPanel x:Name="settingsPanel" Orientation="Vertical">
<StackPanel x:Name="langPanel" Orientation="Horizontal">
<TextBlock x:Name="langTextBlock" Text="{Binding Path=LocalizedResources.DefaultLanguageText, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="#FF501F6E" FontWeight="Bold" FontSize="25" Width="Auto"/>
<Button Content="English" Height="70" HorizontalAlignment="Right" Margin="5,1,0,0" Name="langbutton" VerticalAlignment="Center" MinWidth="160" Foreground="#FF501F6E" Click="language_Btn_clicked" BorderBrush="{x:Null}">
<Button.Background>
<ImageBrush Stretch="Fill" ImageSource="Images/blank_button_nav.png" />
</Button.Background>
</Button>
<!--<Image x:Name="arrow" Stretch="Fill" Margin="0,0,0,0" Source="Images/arrow.png" Height="20"/>-->
</StackPanel>
<StackPanel x:Name="pagePanel" Orientation="Horizontal">
<TextBlock x:Name="pageTextBlock" Text="{Binding Path=LocalizedResources.PerPageText, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="#FF501F6E" FontWeight="Bold" FontSize="25" Width="Auto"/>
<Button Content="25" Height="70" HorizontalAlignment="Right" Margin="5,1,0,0" …Run Code Online (Sandbox Code Playgroud)