【发布时间】:2012-01-26 13:48:17
【问题描述】:
我正在寻找使用ListView 构建菜单(我愿意使用任何其他真正可以达到我正在寻找的效果的东西。我想模仿的外观如下。
这是我目前用于 XAML 的内容。
<ListView
ItemsSource="{Binding Decisions}"
SelectedItem="{Binding SelectedDecision}"
HorizontalAlignment="Left"
BorderThickness="0"
Width="350"
FontSize="12">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel
Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Border
BorderThickness="1"
BorderBrush="#DDD"
CornerRadius="2">
<TextBlock
Text="{Binding Converter={StaticResource DecisionTypeNameConverter}}"
Padding="8"
Background="#EEE" />
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
这会产生一个看起来不错的菜单,直到我选择一个项目。一旦选择了一个项目,它就会被难看的深蓝色包围。如何在 XAML 中重新创建这种外观(不需要渐变效果)?
【问题讨论】:
标签: wpf xaml listview styling listviewitem