[英]Curve the border of silverlight listbox control
弯曲silverlight列表框控件的边界:
我只想弯曲silverlight列表框边框的两端。
我做错什么了吗,因为我无法获得边界曲线:
<Style TargetType="ListBox" x:Key="listboxStyle">
<Setter Property="Padding" Value="1"/>
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Grid Background="White">
<Border Background="White" BorderThickness="0" CornerRadius="10">
<ScrollViewer Background="White" x:Name="ScrollViewerElement" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
好的,我完成了,不需要设置列表框控件的样式。
<Border BorderBrush="White" BorderThickness="0" CornerRadius="5" Background="White" >
<ListBox x:Name="lstEnities" BorderThickness="0" Margin="5" Grid.Row="0"></ListBox>
</Border>
请检查如何编辑ListBox(或任何WPF控件)的控件模板-http: //msdn.microsoft.com/zh-cn/library/ms754242.aspx您可以在控件模板内的Border上设置CornerRadius。
选中此部分使用Template和ControlTemplate最小化模板化ListBox和ListBoxItem:
该博客文章
博客的作者是列表框控件的作者(我记得)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.