我有一个带有一组按钮的 XAML 用户控件。
我的 XAML 如下:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" Width="85"
>
<Grid Background="#7F010305" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="Zoom" Grid.Row="0" Grid.Column="0" Width="40" Height="40" Margin="15,0,15,15" Click="OnClicked" Tapped="OnClicked" />
<Button x:Name="Pan" Grid.Row="1" Grid.Column="0" Width="40" Height="40" Margin="15,0,15,15" Click="OnClicked" Tapped="OnClicked" />
<Button x:Name="Contrast" Grid.Row="2" Grid.Column="0" Width="40" Height="40" Margin="15,0,15,15" Click="OnClicked" Tapped="OnClicked"/>
<Button x:Name="Brightness" Grid.Row="3" Grid.Column="0" Width="40" Height="40" Margin="15,0,15,15" Click="OnClicked" Tapped="OnClicked"/>
</Grid>
不知何故,点击或点击事件没有被引发。我尝试了各种选项,但 Click 或 Tapped 事件没有被触发。
有什么提示吗?