我正在使用C#WPF和Material Design。
我有这个按钮
<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>
但是我看到,当光标位于按钮内的图标上方时,光标不会变为手形,单击也不起作用。
有人知道为什么会这样吗?
答案 0 :(得分:0)
Here我找到了。
/// 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();
这意味着您应该更改
<Button.CommandParameter>
<system:Boolean>False</system:Boolean>
</Button.CommandParameter>
到
<Button.CommandParameter>
<system:Boolean>True</system:Boolean>
</Button.CommandParameter>