我有一个带有简单控制模板的按钮:
<Page.Resources>
<ControlTemplate x:Key="LButton" TargetType="Button">
<Border BorderThickness="2" BorderBrush="White"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock FontSize="52" FontWeight="Thin"
TextAlignment="Right"
Text="Hello"
Margin="30 0 0 30"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"/>
</Border>
</ControlTemplate>
</Page.Resources>
<Button Grid.Row="1" Grid.Column="0"
Style="{StaticResource launchButton}"
Template="{StaticResource LButton}"
Margin="0 10 10 0"
x:Name="LoyalityButton" Opacity="0" Click="L_Click"/>
但是只有当我点击TextBlock时,事件点击才会上升。我需要做些什么才能使click事件引发我触摸的事件到按钮上的空白区域?
答案 0 :(得分:1)
您可以设置Border的Background属性,现在它是透明的,透明度意味着对于测试不可见。