示例#1
0
        public void Bind(TextNode model)
        {
            Unbind ();
            this.model = model;
//          this.model.PropertyChanged += HandlePropertyChanged;
            this.handlers = new List<PropertyChangedEventHandler> ();
            this.handlers.Add(this.labelCaption.Bind (model, "Caption"));
            this.handlers.Add(this.textText.Bind(model, "Text"));

            this.model.PropertyChanged += HandlePropertyChanged;
            this.textText.Enabled = this.model.Enabled;
        }
示例#2
0
 public void Unbind()
 {
     if (this.handlers != null)
     {
         foreach (var handler in this.handlers)
         {
             this.model.PropertyChanged -= handler;
         }
     }
     if (this.model != null)
     {
         this.model.PropertyChanged -= HandlePropertyChanged;
     }
     this.model = null;
 }