我把按钮放在了gridsplitter里面。我的目的是制作可点击的网格分割器以及可滑动的。我的问题是在将按钮放入网格分割器后,完全无法通过鼠标拖动。如何将网格分割器配置为可点击和可滑动。
<GridSplitter BorderThickness="1" HorizontalAlignment="Stretch" Grid.Column="1" >
<GridSplitter.Template>
<ControlTemplate TargetType="{x:Type GridSplitter}">
<Grid>
<Button Name="btnSplit" Content="⁞" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding SplitterClickCommand}" CommandParameter="{Binding ElementName=btnSplit}" ></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
</ControlTemplate>
</GridSplitter.Template>
</GridSplitter>
最好的Rgds DF
答案 0 :(得分:0)
尝试在MouseDoubleClick
上订阅GridSplitter
个活动:
<GridSplitter BorderThickness="1" HorizontalAlignment="Stretch" Grid.Column="1" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding SplitterClickCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</GridSplitter>
如果MouseDoubleClick
事件不适合您,您可以尝试订阅MouseDown
或MouseLeftButtonDown.