• 显示隐藏的动画


    一:xaml版

    <TextBlock Height="23" HorizontalAlignment="Left" Cursor="Hand" Margin="10,10,0,0" Name="tbClick" Text="Click To Show" VerticalAlignment="Top" />
            <ListView Name="lvRoot" Width="200" Height="0">
                <ListView.View>
                    <GridView>
                        <GridViewColumn DisplayMemberBinding="{Binding ShowColor}" Header="Color" Width="200" />
                    </GridView>
                </ListView.View>
            </ListView>

    二:后台绑定

    DoubleAnimation animation = null;
                if (!flag)
                {
                    animation = new DoubleAnimation();
                    animation.From = 0;
                    animation.To = 200;
                    animation.Duration = new Duration(TimeSpan.FromSeconds(1));
                    Storyboard.SetTargetName(animation, lvRoot.Name);
                    Storyboard.SetTargetProperty(animation, new PropertyPath(HeightProperty));
                    flag = true;
                }
                else
                {
                    animation = new DoubleAnimation();
                    animation.From = 200;
                    animation.To = 0;
                    animation.Duration = new Duration(TimeSpan.FromSeconds(1));
                    Storyboard.SetTargetName(animation, lvRoot.Name);
                    Storyboard.SetTargetProperty(animation, new PropertyPath(ListView.HeightProperty));
                    flag = false;
                }
                Storyboard board = new Storyboard();
                board.Children.Add(animation);
                board.Begin(this);
  • 相关阅读:
    GIT学习实践笔记
    ubuntu 安装pygit2
    强化vim打造python的IDE
    Python Django学习和实践
    浏览器调试工具网页性能分析中的使用
    公司发版shell脚本重构
    Nightwatch+gulp
    Git
    JavaScript Unit Test with Qunit
    Unit Test Mocking Framework
  • 原文地址:https://www.cnblogs.com/kelei12399/p/2594676.html
Copyright © 2020-2023  润新知