是否可以通过将鼠标拖过它们来切换多个ToggleButton的状态(按住鼠标左键)?
答案 0 :(得分:1)
框中没有任何内容可以支持此功能,但您应该能够订阅MouseMove并在按下按钮时切换状态。
答案 1 :(得分:0)
<ToggleButton Content="ToggleButton" MouseEnter="ToggleButtonMouseEnter" Width="80" HorizontalAlignment="Left"/>
private void ToggleButtonMouseEnter(object sender, MouseEventArgs e)
{
System.Windows.Controls.Primitives.ToggleButton tb = (System.Windows.Controls.Primitives.ToggleButton)sender;
if(e.LeftButton == MouseButtonState.Pressed) tb.IsChecked = !tb.IsChecked;
}