zoukankan      html  css  js  c++  java
  • Binding 依赖属性定义

    class BackgroundPath:Image
        {
            public event PropertyChangedEventHandler PropertyChanged;
            static BackgroundPath()
            {
                BindSourceProperty =
                DependencyProperty.Register("BindSource",
                typeof(BitmapImage),
                typeof(BackgroundPath),
                new PropertyMetadata(new BitmapImage(new Uri(PathShow.ImageSelected)), OnBitmapImageChanged));
            }
    
            public BitmapImage BindSource
            {
                get
                {   return (BitmapImage)GetValue(BindSourceProperty);}
                set
                {   SetValue(BindSourceProperty, value);}
            }
            public static DependencyProperty BindSourceProperty { private set; get; }
    
            static void OnBitmapImageChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
            {
                (obj as BackgroundPath).OnBitmapImageChanged(args);
            }
    
            void OnBitmapImageChanged(DependencyPropertyChangedEventArgs args)
            {
                if (args.Property == BindSourceProperty)
                    BindSource = (BitmapImage)args.NewValue;
            }
        }
    
    
     Binding bind = new Binding()
                {
                    Source = new BackgroundPath(),
                    Path = new PropertyPath("BindSource")
                };
                faceImge.SetBinding(Image.SourceProperty,bind);
  • 相关阅读:
    nginx日志、变量
    http相关
    nginx.conf文件的使用
    NA交换①
    第一章 何为网络
    第二章 以太网
    SATA、SCSI、SAS
    第十章 安全
    附录A 思科互联网络操作系统(IOS)
    标准ACL、扩展ACL和命名ACL的配置详解
  • 原文地址:https://www.cnblogs.com/yunqie/p/7002314.html
Copyright © 2011-2022 走看看