Consider the following xaml snippet:
<ToolBarTray>
<ToolBar Band="1" BandIndex="1">
<Button>Go</Button>
<Separator></Separator>
<Button>Camera 1</Button>
<Button>Camera 2</Button>
<Button>Camera 3</Button>
</ToolBar>
</ToolBarTray>
How can I set the Camera 1 - 3 in a way that when one of them is clicke开发者_如何学编程d it stays down (selected)?
use RadioButton
s with the same GroupName
. If you want them to look like buttons, borrow style from ToggleButton
.
<RadioButton Content="Camera 1" Style="{StaticResource {x:Type ToggleButton}}" GroupName="Camera" />
<RadioButton Content="Camera 2" Style="{StaticResource {x:Type ToggleButton}}" GroupName="Camera" />
<RadioButton Content="Camera 3" Style="{StaticResource {x:Type ToggleButton}}" GroupName="Camera" />
精彩评论