• silverlight中为控件添加可以在标签中设置的属性


    public static readonly DependencyProperty ExcerciseStatusProperty;
            static comCoreDamage()
            {
    
                ExcerciseStatusProperty = DependencyProperty.Register("ExcerciseStatus",
                                               typeof(int),
                                               typeof(comCoreDamage),
                                               new PropertyMetadata(2, new PropertyChangedCallback(comCoreDamage.OnTextPropertyChanged)));
            }
            
            //此控件的C#属性
            public int ExcerciseStatus
            {
                get
                {
                    return (int)base.GetValue(ExcerciseStatusProperty);
                }
                set
                {
                    base.SetValue(ExcerciseStatusProperty, value);
                }
            }
    
            private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
                ////是否为编辑态
                if (!DesignerProperties.IsInDesignTool)
                {
                    (d as comCoreDamage).OnTextPropertyChanged(e);
                }
            }
    
            void OnTextPropertyChanged(DependencyPropertyChangedEventArgs e)
            {
                try
                {
                    curExcerciseStatus = (int)e.NewValue;
                }
                catch (Exception ex)
                {
                    string ks = ex.ToString();
                }
    
            }
            #endregion
    View Code
  • 相关阅读:
    MapBox TileMill
    优秀电影
    Mapnik 编译安装过程
    Debian 入门安装与配置2
    学习opengl十大网站(转载)
    PostgresSQL 学习资料记录处
    c++模板编程-异质链表
    Linux-统一事件源
    三组I/O复用模型的比较
    ZigZag-LeetCode
  • 原文地址:https://www.cnblogs.com/hbhzz/p/3205881.html
Copyright © 2020-2023  润新知