1
我想在XAML中为CornerRadius添加ListView的样式我有一种方法,但这在我的情况下不起作用。 喜欢这个。如何在XAML中添加ListView CornerRadius
<ListView.Style>
<Style TargetType="{x:Type ListView}">
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<Border CornerRadius="5">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- here we go -->
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Pink"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Pink"/>
</Style.Resources>
</Style>
</ListView.Style>
这将不会显示我的ItemsSource的数据,所以我的Listview是这样的。
<ListView x:Name="MenuBarList"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Height="{Binding MainMenuHeight}"
Width="{Binding MainMenuWidth}"
ItemsSource="{Binding}"
Foreground="White"
Background="#FF3D61D0"
SelectionMode="Single">
所以我如何添加这种风格。 谢谢.. ..