Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Events Windows Phone自定义按钮单击";面积“;_Events_Button_Windows Phone_Click - Fatal编程技术网

Events Windows Phone自定义按钮单击";面积“;

Events Windows Phone自定义按钮单击";面积“;,events,button,windows-phone,click,Events,Button,Windows Phone,Click,我已经读了很多关于这个论点的书,但是我自己找不到解决我的具体问题的办法。 我已经用xaml(一个圆圈,里面有一个字母)为集成到我的应用程序中的个人键盘创建了一个自定义按钮样式;问题在于:单击事件仅在按下字母时才被清除,但我希望使所有按钮区域都合理。 这是我的密码: <Style x:Key="ButtonStyle" TargetType="Button"> <Setter Property="Template"> <Setter.Value>

我已经读了很多关于这个论点的书,但是我自己找不到解决我的具体问题的办法。 我已经用xaml(一个圆圈,里面有一个字母)为集成到我的应用程序中的个人键盘创建了一个自定义按钮样式;问题在于:单击事件仅在按下字母时才被清除,但我希望使所有按钮区域都合理。 这是我的密码:

<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="Button">
            <Grid>
                <Border CornerRadius="100" 
                BorderThickness="3" 
                BorderBrush="Black"
                Margin="1"
                Padding="0">
                    <Grid x:Name="ContentContainer">
                        <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                </Border>
            </Grid>
        </ControlTemplate>
    </Setter.Value>
</Setter>


私有无效键盘按钮\单击(对象发送器,路由目标e)
{
....
}

我认为您没有背景设置,因此按钮区域对于触摸来说是不可见的。尝试设置
“Background”=“Transparent”
在外部
边框中

使用提供的代码对其进行测试。在Border属性中将背景设置为透明时,它确实起作用<代码>
<Button HorizontalAlignment="Left" VerticalAlignment="Top" Click="KeyboardButton_Click" Style="{StaticResource ButtonStyle}" Content="Q" MinWidth="40" MinHeight="40" />


private void KeyboardButton_Click(object sender, RoutedEventArgs e)
{
    ....
}