C# wp8中带有图像的按钮的不同高度
我在xaml中有一个按钮定义为C# wp8中带有图像的按钮的不同高度,c#,html,windows-phone-8,C#,Html,Windows Phone 8,我在xaml中有一个按钮定义为 可以看出,我专门将按钮的高度和宽度设置为与图像相等,但是在xaml中,它没有正确地包装图像,并显示更多的宽度和高度。发生了什么事 为什么这个框更大,为什么我不能正确设置边距而不是40,我必须给出71个值。有一个额外的边距,它不是您可以在“属性”框中编辑的属性的一部分。但是,您可以通过编辑其模板对其进行编辑 联机文档->选择按钮->编辑模板->编辑副本 去掉边框上的Margin=“{StaticResource PhoneTouchTargetOverhang
可以看出,我专门将按钮的高度和宽度设置为与图像相等,但是在xaml中,它没有正确地包装图像,并显示更多的宽度和高度。发生了什么事
为什么这个框更大,为什么我不能正确设置边距而不是40,我必须给出71个值。
有一个额外的边距,它不是您可以在“属性”框中编辑的属性的一部分。但是,您可以通过编辑其模板对其进行编辑
联机文档->选择按钮->编辑模板->编辑副本
去掉边框上的Margin=“{StaticResource PhoneTouchTargetOverhang}”
,它将正确拉伸
你能告诉我在哪里可以得到所有钥匙的列表吗?例如,如果我想知道TextBox的钥匙等?@MuhammadUmar我不知道你的意思。你的意思是得到文本框里的东西吗?
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0">
<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Button BorderBrush="Transparent" Click="Menu_Btn" Margin="71,584,0,-2" Height="36" Width="38" Padding="0" Style="{StaticResource ButtonStyle1}">
<Image Source="Assets/menu.png" Stretch="UniformToFill" Height="36" Width="38"/>
</Button>