我开发了一个椭圆形的按钮。
<Style x:Key="CircleImageButton" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{ThemeResource PhoneForegroundBrush}" />
<Setter Property="Foreground" Value="{ThemeResource PhoneForegroundBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource PhoneBorderThickness}" />
<Setter Property="FontFamily" Value="{ThemeResource PhoneFontFamilyNormal}" />
<Setter Property="FontWeight" Value="{ThemeResource PhoneButtonFontWeight}" />
<Setter Property="FontSize" Value="{ThemeResource TextStyleLargeFontSize}" />
<Setter Property="Padding" Value="{ThemeResource PhoneButtonContentPadding}" />
<Setter Property="MinHeight" Value="{ThemeResource PhoneButtonMinHeight}" />
<Setter Property="MinWidth" Value="{ThemeResource PhoneButtonMinWidth}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="Grid" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Pressed" To="PointerOver">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="ImageEllipse" />
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="ImageEllipse" />
</Storyboard>
</VisualTransition>
<VisualTransition From="Pressed" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="ImageEllipse" />
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="ImageEllipse" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageEllipse" Storyboard.TargetProperty="(Shape.Fill).(ImageBrush.ImageSource)">
<DiscreteObjectKeyFrame KeyTime="0" Value="ms-appx:///Assets/Buttons/photo_icon_tap.png" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Ellipse x:Name="ImageEllipse"
MinWidth="127"
MinHeight="127">
<Ellipse.Fill>
<ImageBrush ImageSource="ms-appx:///Assets/Buttons/photo_icon_pas.png" />
</Ellipse.Fill>
</Ellipse>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
当我按下按钮时,没有错误信息,但没有图片。
我认为属性 Storyboard.TargetProperty =&#34;(Shape.Fill)。(ImageBrush.ImageSource)&#34;