• 笔记


    1.故事板的时间定义,之前一直没看懂 表示为时分秒
    <DoubleAnimation 
                    Storyboard.TargetName="MyRectangle"
                    Storyboard.TargetProperty="Width"
                    From="100" To="200" Duration="0:0:1" />
    
    Duration="0:0:1"  表示 时:分:秒
    2.路径说明
    <Path Data="M0 0 12 12M0 12 12 0" Stroke="White" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Center">
    
    Data 中M 为move 即移动到(0,0) 画线到(12,12) 在移动到(0,12) 画线(12,0) ,中间M为移动到,如果没有的话  会直接画线
    以上为画一个X 
    3.代码片段
    vs->工具->代码片段管理器 打开后
    切换语言为Cshape,复制位置的路径,在资源管理器中打开。
    创建代码片段即可。
    本例:复制一个propfull  改名为propn 
    打开propn  修改文件里面的propfull->probn
    <Title>propn</Title>
    <Shortcut>propn</Shortcut>
    public $type$ $property$
        {
            get { return $field$;}
            set { $field$ = value;this.DoNotify();}
        }
        $end$]]>
    4.增加(CallerMemberNameAttribute/CallerFilePathAttribute/CallerLineNumberAttribute)这3个特性
    
    这3个特性是.net 4.5中新增的,如果要在低版本中使用,需要增加,类
    namespace System.Runtime.CompilerServices
    {
        [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
        public class CallerMemberNameAttribute : Attribute
        {
    
        }
    
        [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
        public class CallerFilePathAttribute : Attribute
        {
    
        }
    
        [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
        public class CallerLineNumberAttribute : Attribute
        {
    
        }
    }
    
    在通知属性接口基类中,增加特性限定,可以自动识别属性名称,减少复制代码后忘记修改报错的尴尬。
    
     public class NotifyBase : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            public void DoNotify([CallerMemberName] string propName="")
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
            }
        }
    
        public class UserInfo:NotifyBase
        {
            private int age;
    
            public int Age
            {
                get { return age; }
                set { age = value; this.DoNotify(); }
            }
            private string name;
    
            public string Name
            {
                get { return name; }
                set { name = value; this.DoNotify(); }
            }
    
        }
  • 相关阅读:
    算数表达式二叉树
    Java汉诺塔算法
    Struts2中的设计模式ThreadLocal模式续
    Java基础知识总结(五)
    Java数组扩容算法及Java对它的应用
    Java Arrays.sort源代码解析
    Java字符串排列算法
    Java基础知识总结(三)
    SSIS OLE DB Source中执行带参数的存储过程
    Sql server中Collation conflict问题
  • 原文地址:https://www.cnblogs.com/ankeyliu/p/14749321.html
Copyright © 2020-2023  润新知