WPF效果第一百九十三篇之登录实现

前面一直在玩耍ListBox(最爱),大周末的就适合在家吹着风扇撸着代码63ed186f13e75c59a931b5e57c0f9c73.png;今天来分享一个很简单实用的登录,来看看最终实现的效果:

1、关于软件启动后焦点实现:

<Style TargetType="Border">
    <Style.Triggers>
        <DataTrigger Binding="{Binding IsEmptyAccount,Mode=TwoWay}" Value="true">
            <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=UserNameTxb}"/>
        </DataTrigger>
    </Style.Triggers>
</Style>

2、关于启动窗口动画:

<Storyboard x:Key="LoadStoryboard">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoginWindow">
        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LoginWindow"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
        <SplineDoubleKeyFrame KeyTime="00:00:0" Value="0"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.6" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LoginWindow"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
        <SplineDoubleKeyFrame KeyTime="00:00:0" Value="0"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.6" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

3、关于窗口抖动动画:

<Storyboard x:Key="ShakeStoryboard" Completed="ShakeStoryboard_Completed">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
        <SplineDoubleKeyFrame KeyTime="00:00:0" Value="1"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.2" Value="0.7"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.4" Value="0.8"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.5" Value="0.9"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.6" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
        <SplineDoubleKeyFrame KeyTime="00:00:0" Value="1"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.2" Value="0.7"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.4" Value="0.8"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.5" Value="0.9"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.6" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00.6" Storyboard.TargetName="LayoutRoot"
                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
        <SplineDoubleKeyFrame KeyTime="00:00:0.2" Value="10"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.3" Value="-20"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.4" Value="10"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.5" Value="-16"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.6" Value="10"/>
        <SplineDoubleKeyFrame KeyTime="00:00:0.7" Value="0"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

最终简单的效果先这样吧a9bc91dba5510012236aedfa7922ade8.png;以后有时间的话,可以再去摸索一下更复杂的效果6578a537666c4d363cb39f370557341e.png;编程不息、Bug不止、无Bug、无生活4dfe4648411cacb0523f36b272222450.png;改bug的冷静、编码的激情、完成后的喜悦、挖坑的激动 、填坑的兴奋;这也许就是屌丝程序员的乐趣吧;今天就到这里吧;希望自己有动力一步一步坚持下去;生命不息,代码不止;大家抽空可以看看今天分享的效果,有好的意见和想法,可以在留言板随意留言;我看到后会第一时间回复大家,多谢大家的一直默默的关注和支持!如果觉得不错,那就伸出您的小手点个赞并关注一下!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值