【发布时间】:2013-08-25 18:41:41
【问题描述】:
我想模仿一组 ToggleButtons 的样式,如下图所示。任何时候都只能“选中”其中一个按钮。
我的问题与样式有关:
- 我想在最左边的按钮和最右边的按钮上有圆角,如图所示,但如果中间有一个按钮(如图所示),那不应该有圆角。有时可能只有两个按钮可以切换。
- 我需要不同状态的样式:至少是“正常/未选中”、“鼠标悬停”、“按下”和“选中”。
我正在使用的当前控件是这样完成的:
<StackPanel Orientation="Horizontal" >
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="All" Padding="12,8,12,8" GroupName="View" />
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Geolocated" Padding="12,8,12,8" GroupName="View" />
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Non Geolocated" Padding="12,8,12,8" GroupName="View" />
</StackPanel>
在 StackPanel 资源中,我尝试为 ToggleButton 设置样式,但我很迷茫如何实现上图中的结果。
【问题讨论】:
标签: wpf styles radio-button togglebutton