Xaml 在ListView项周围放置边框的最佳方法
我有一个ListView,我想在ListView中的每个项目周围加一个边框。微软似乎没有为Border元素设置系统主题 什么是推荐的方法主题的边界,使它看起来很好的黑暗和光明的主题 这是我的列表视图Xaml 在ListView项周围放置边框的最佳方法,xaml,windows-runtime,windows-phone,windows-phone-8.1,Xaml,Windows Runtime,Windows Phone,Windows Phone 8.1,我有一个ListView,我想在ListView中的每个项目周围加一个边框。微软似乎没有为Border元素设置系统主题 什么是推荐的方法主题的边界,使它看起来很好的黑暗和光明的主题 这是我的列表视图 <ListView ItemsSource="{Binding Products}" Header="My Header" Margin="10,5,10,5"> <ListView.HeaderTemplate>
<ListView ItemsSource="{Binding Products}" Header="My Header" Margin="10,5,10,5">
<ListView.HeaderTemplate>
<DataTemplate>
<TextBlock Text="My Header" Style="{ThemeResource HeaderTextBlockStyle}" />
</DataTemplate>
</ListView.HeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<Border>
<StackPanel>
<TextBlock Text="{Binding Name}"
Style="{StaticResource TitleTextBlockStyle}" />
<TextBlock Text="TextBlock 1:"
Style="{StaticResource ControlHeaderTextBlockStyle}" />
<TextBox Text="{Binding TextBlock1}"/>
<TextBlock Text=" TextBlock 2:"
Style="{ThemeResource ControlHeaderTextBlockStyle}"/>
<TextBox Text="{Binding TextBlock2}"/>
</StackPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
*************编辑1***********************
我应该把这个放进去。我希望它能出现在面向WP8.1和Windows 8.1的通用应用程序中,而不仅仅是手机。您可能只需要标准的前景色,对吗?(黑暗代表光明,光明代表黑暗)。那将是最好的选择
前面的答案让我看了一下系统刷,我发现ApplicationForegroundThemeBrush,我相信它会起作用。+1我更喜欢对比ForeGroundBrush,忘了那个,事实上我想我会删除我的答案,因为它超出了所需的范围。:)在Windows Phone 8.1中找不到PhoneControlForeGroundBrush,只有Windows Phone Silverlight 8.1。
<Border BorderThickness="1" BorderBrush="{StaticResource PhoneContrastForegroundBrush}">