GridSplitter 内的按钮不起作用 WPF MVVM

Button inside the GridSplitter not working WPF MVVM

我把按钮放在 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

尝试在 GridSplitter 上订阅 MouseDoubleClick 事件:

<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活动不适合您,可以尝试订阅MouseDownMouseLeftButtonDown.