Windows phone 之自定义控件(补充)

<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"
    x:Class="Weather.CityTile"
    d:DesignWidth="184"
    d:DesignHeight="105">
    <UserControl.Resources>
        <Style x:Key="ButtonStyle1" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="LayoutRoot" Background="Transparent" RenderTransformOrigin="0.5,0.5">
                            <!--变形的中心位置-->
                            <Grid.RenderTransform>
                                <CompositeTransform/>
                            </Grid.RenderTransform>
                            <VisualStateManager.VisualStateGroups>
                                <!--管理器类型.状态组-->
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <!--视觉过渡转换,设置单个的状态组里不同状态切换时的动画效果-->
                                        <VisualTransition GeneratedDuration="0:0:1" To="Pressed">
                                            <VisualTransition.GeneratedEasingFunction>
                                                <BackEase EasingMode="EaseOut"/>
                                            </VisualTransition.GeneratedEasingFunction>
                                        </VisualTransition>
                                        <VisualTransition GeneratedDuration="0:0:1" To="Normal">
                                            <VisualTransition.GeneratedEasingFunction>
                                                <BackEase EasingMode="EaseOut"/>
                                            </VisualTransition.GeneratedEasingFunction>
                                        </VisualTransition>
                                        <VisualTransition GeneratedDuration="0:0:1" To="MouseOver">
                                            <VisualTransition.GeneratedEasingFunction>
                                                <BackEase EasingMode="EaseOut"/>
                                            </VisualTransition.GeneratedEasingFunction>
                                        </VisualTransition>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Disabled"/>
                                    <!--设置单个的状态的动画效果-->
                                    <VisualState x:Name="Normal"/>
                                    <!--设置单个的状态的动画效果-->
                                    <VisualState x:Name="MouseOver"/>
                                    <!--设置单个的状态的动画效果-->
                                    <VisualState x:Name="Pressed">
                                        <!--设置单个的状态的动画效果-->
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
To="0.8" Storyboard.TargetProperty="(UIElement.RenderTransform).
(CompositeTransform.ScaleX)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True"/>
                                            <DoubleAnimation
Duration="0" To="0.8" Storyboard.TargetProperty="(UIElement.RenderTransform).
(CompositeTransform.ScaleY)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Image Source="/Weather;component/UserControl/base.png" Stretch="Fill"/>
                            <Image Margin="90,-14,0,32" Source="{Binding cityWeatherIcon}"/>
                            <TextBlock Text="{Binding cityTemperature}" FontSize="20"  Width="100" Margin="8,8,8,8" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
                            <ContentPresenter HorizontalAlignment="Left" Height="40" Margin="8,8,0,0" VerticalAlignment="Top"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="FontSize" Value="26"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>
    </UserControl.Resources>

    <!--<Button Name="cityName" Content="" Style="{StaticResource ButtonStyle1}"/>-->

</UserControl>
上一篇:精尽Spring Boot源码分析 - 文章导读


下一篇:云主机安装Tomcat上传自己的网站