Xaml 按钮模板屏蔽了按钮的可点击区域
我有以下UWP XAML:Xaml 按钮模板屏蔽了按钮的可点击区域,xaml,windows-10,uwp,vector-graphics,Xaml,Windows 10,Uwp,Vector Graphics,我有以下UWP XAML: <Button Content="Scan" Command="{Binding CommandScan}" ToolTipService.ToolTip="Scan" Style="{StaticResource ButtonIconStyle}"> <Button.Template> <ControlTemplate TargetType="Button"> &l
<Button Content="Scan"
Command="{Binding CommandScan}" ToolTipService.ToolTip="Scan"
Style="{StaticResource ButtonIconStyle}">
<Button.Template>
<ControlTemplate TargetType="Button">
<resources:ScanIcon />
</ControlTemplate>
</Button.Template>
</Button>
ScanIcon
是一个包含矢量图像的用户控件。似乎正在发生的是,图标遮住了可点击按钮区域-也就是说,我只能点击图标的绘图区域,按钮的背景(仍在按钮的边框内)不可点击
因此,我的问题是:是什么导致了这种行为,我如何能够覆盖它?您可以尝试将
按钮
控制模板
单独放置,并将图像插入按钮
的背景
。我的意思是-当你想要超越风格的时候,你不需要开枪。如果需要将按钮
精确设置为图像的形状,可以尝试使用DrawingBrush
,如下所述: