C# 材质设计按钮内的图标不显示';点击

C# 材质设计按钮内的图标不显示';点击,c#,wpf,button,material-design,C#,Wpf,Button,Material Design,我正在从事C#WPF和材料设计 我有这个按钮 <Button x:Name="btnClose" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Style="{StaticResource MaterialDesignIconForegroundButton}"

我正在从事C#WPF和材料设计

我有这个按钮

        <Button x:Name="btnClose"
                Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
                Style="{StaticResource MaterialDesignIconForegroundButton}"
                Background="White"
                BorderBrush="Transparent"
                Cursor="Hand"
                VerticalAlignment="Top"
                HorizontalAlignment="Right"
                Margin="0 20 25 0">
            <materialDesign:PackIcon Kind="Close"
                                     Foreground="Gray"
                                     Height="28"
                                     Width="28" />
            <Button.CommandParameter>
                <system:Boolean>False</system:Boolean>
            </Button.CommandParameter>
        </Button>

假的
但我看到,当光标位于按钮内的图标上时,光标不会变为手,点击也不起作用

有人知道为什么会这样吗?

我找到了这个

/// Routed command to be used inside dialog content to close a dialog. Use a <see cref="Button.CommandParameter"/> to indicate the result of the parameter.
/// </summary>
public static RoutedCommand CloseDialogCommand = new RoutedCommand();
///在对话框内容中使用的用于关闭对话框的路由命令。使用a指示参数的结果。
/// 
公共静态RoutedCommand CloseDialogCommand=新RoutedCommand();
这意味着你应该改变

<Button.CommandParameter>
    <system:Boolean>False</system:Boolean>
</Button.CommandParameter>

假的


真的

是否检查命令的
CanExecute
是否返回true?。尝试删除命令绑定,并查看它是否重新启用。您能否发布
CloseDialogCommand
的内容?问题在于您选择的按钮样式。他们用于关闭packicon的图标或路径将X创建为缺勤。它不是图标,因此也不是前景。你选择了MaterialDesigningRecorgroundButton,它的内在设计似乎是让前台——你选择的图标——成为唯一可以点击的部分。我认为材料设计风格中存在一个缺陷,因为我看到,当我没有在按钮中添加边距时,问题不会发生,只有当我定义边距时,问题才会发生。谢谢你的帮助。
<Button.CommandParameter>
    <system:Boolean>True</system:Boolean>
</Button.CommandParameter>