private void HandlePropertyValueChanged(object sender, DPropertyValueChangedEventArgs e)
        {
            if (e.OldValue is IAttachedPropertiesContainer)
            {
                var oldContainer = e.OldValue as IAttachedPropertiesContainer;

                if (oldContainer != null)
                {
                    oldContainer.AddedItem   += HandleAddedItem;
                    oldContainer.RemovedItem += HandleRemovedItem;
                }
            }

            var container = e.NewValue as IAttachedPropertiesContainer;

            if (container != null)
            {
                Property = container.GetProperty(Item, PropertyName);

                container.AddedItem   += HandleAddedItem;
                container.RemovedItem += HandleRemovedItem;
            }
            else
            {
                Property = null;
            }
        }
		private void HandlePropertyChanged (object sender, DPropertyValueChangedEventArgs e)
		{		
			if (Source != null) {
				Source.DependencyPropertyValueChanged -= HandlePropertyValueChanged;

				var container = Source.Value as IAttachedPropertiesContainer;

				if (container != null) {
					container.AddedItem -= HandleAddedItem;
					container.RemovedItem -= HandleRemovedItem;
				}
			}

			Source = e.NewValue as IDependencyProperty;

			if (Source != null) {
				var container = Source.Value as IAttachedPropertiesContainer;

				if (container != null) {
					Property = container.GetProperty (Item, PropertyName);

					container.AddedItem += HandleAddedItem;
					container.RemovedItem += HandleRemovedItem;
				}
				Source.DependencyPropertyValueChanged += HandlePropertyValueChanged;
			} else {
				Property = null;
			}
		}
        private void HandlePropertyChanged(object sender, DPropertyValueChangedEventArgs e)
        {
            if (Source != null)
            {
                Source.DependencyPropertyValueChanged -= HandlePropertyValueChanged;

                var container = Source.Value as IAttachedPropertiesContainer;

                if (container != null)
                {
                    container.AddedItem   -= HandleAddedItem;
                    container.RemovedItem -= HandleRemovedItem;
                }
            }

            Source = e.NewValue as IDependencyProperty;

            if (Source != null)
            {
                var container = Source.Value as IAttachedPropertiesContainer;

                if (container != null)
                {
                    Property = container.GetProperty(Item, PropertyName);

                    container.AddedItem   += HandleAddedItem;
                    container.RemovedItem += HandleRemovedItem;
                }
                Source.DependencyPropertyValueChanged += HandlePropertyValueChanged;
            }
            else
            {
                Property = null;
            }
        }
		private void HandleItemsPanelChanged (object sender, DPropertyValueChangedEventArgs<Panel> e)
		{
			if (e.OldValue != null)
				RemoveVisualChild (e.OldValue);
				
			if (e.NewValue != null)
				AddVisualChild (e.NewValue);
		}						
		private void HandleHeaderChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			if (e.OldValue is UIElement)
				(e.OldValue as UIElement).PreviewButtonPressEvent -= HandleHeaderPreviewButtonPressEvent;

			if (e.NewValue is UIElement)
				(e.NewValue as UIElement).PreviewButtonPressEvent += HandleHeaderPreviewButtonPressEvent;
		}
Beispiel #6
0
		private void HandleValueChanged (object sender, DPropertyValueChangedEventArgs<Token> e)
		{
			if (e.OldValue != null)
				e.OldValue.Parent = null;

			if (e.NewValue != null)
				e.NewValue.Parent = this;
		}
		private void HandleContentChanged (object sender, DPropertyValueChangedEventArgs<UIElement> e)
		{				
			if (e.OldValue != null)
				RemoveVisualChild (e.OldValue);
				
			if (e.NewValue != null)
				AddVisualChild (e.NewValue);
		}		
		private void HandleTemplateChanged (object sender, DPropertyValueChangedEventArgs<ControlTemplate> e)
		{
			if (templateControl != null)				
				RemoveVisualChild (templateControl);
			
			templateControl = e.NewValue != null ? e.NewValue.LoadContent (this) : null;
			
			if (templateControl != null)
				AddVisualChild (templateControl);
		}
		private void HandleTargetPropertyChanged (object sender, DPropertyValueChangedEventArgs e)
		{			
			if (TargetProperty != null)
				TargetProperty.DependencyPropertyValueChanged -= HandleTargetValueChanged;

			TargetProperty = e.NewValue as IDependencyProperty;

			if (TargetProperty != null)
				TargetProperty.DependencyPropertyValueChanged += HandleTargetValueChanged;

			UpdateTargetValue ();
		}
		private void HandlePropertyChanged (object sender, DPropertyValueChangedEventArgs e)
		{		
			if (Source != null)
				Source.DependencyPropertyValueChanged -= HandlePropertyValueChanged;

			Source = e.NewValue as IDependencyProperty;

			if (Source != null) {
				if (Source.Value != null)
					Property = (Source.Value as DependencyObject).GetProperty (PropertyName);
				Source.DependencyPropertyValueChanged += HandlePropertyValueChanged;
			}
		}
		private void HandleSelectedItemChanged (object sender, DPropertyValueChangedEventArgs<UIElement> e)
		{
			if (e.OldValue != null) {
				var isSelected = e.OldValue.GetProperty ("IsSelected");
				if (isSelected != null)
					isSelected.Value = false;
			}

			if (e.NewValue != null) {
				var isSelected = e.NewValue.GetProperty ("IsSelected");
				if (isSelected != null)
					isSelected.Value = true;
			}
		}
		private void HandleItemsPanelChanged (object sender, DPropertyValueChangedEventArgs<Panel> e)
		{
			if (e.OldValue != null) {
				e.OldValue.Children.Clear ();

				RemoveVisualChild (e.OldValue);
			}
				
			if (e.NewValue != null) {
				AddVisualChild (e.NewValue);

				foreach (var item in Items) {
					e.NewValue.Children.Add (item.Visual);
				}
			}
		}						
Beispiel #13
0
        private void HandleTargetPropertyChanged(object sender, DPropertyValueChangedEventArgs e)
        {
            if (TargetProperty != null)
            {
                TargetProperty.DependencyPropertyValueChanged -= HandleTargetValueChanged;
            }

            TargetProperty = e.NewValue as IDependencyProperty;

            if (TargetProperty != null)
            {
                TargetProperty.DependencyPropertyValueChanged += HandleTargetValueChanged;
            }

            UpdateTargetValue();
        }
        private void HandlePropertyChanged(object sender, DPropertyValueChangedEventArgs e)
        {
            if (Source != null)
            {
                Source.DependencyPropertyValueChanged -= HandlePropertyValueChanged;
            }

            Source = e.NewValue as IDependencyProperty;

            if (Source != null)
            {
                if (Source.Value != null)
                {
                    Property = (Source.Value as DependencyObject).GetProperty(PropertyName);
                }
                Source.DependencyPropertyValueChanged += HandlePropertyValueChanged;
            }
        }
		private void ItemsSourceChanged (object sender, DPropertyValueChangedEventArgs<IEnumerable> e)
		{
			if (ItemsPanel == null)
				return;
			
			ItemsPanel.Children.Clear ();

			foreach (var o in e.NewValue) {
				var child = ItemTemplate.LoadContent (o);
				ItemsPanel.Children.Add (child);

				items.Add (new ItemVisual () { Item = o, Visual = child });
			}

			if (e.NewValue is INotifyCollectionChanged) {
				var collection = e.NewValue as INotifyCollectionChanged;

				collection.CollectionChanged += HandleCollectionChanged;
			}
		}
		private void HandlePropertyChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			if (Changed != null)
				Changed (this, EventArgs.Empty);
		}
		private void HandleStyleChanged (object sender, DPropertyValueChangedEventArgs<Style> e)
		{
			if (e.OldValue != null)
				RemoveStyle (e.OldValue);

			if (e.NewValue != null)
				ApplyStyle (e.NewValue);
		}
		private void HandlePropertyValueChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			Property = (e.NewValue as DependencyObject).GetProperty (PropertyName);
		}
Beispiel #19
0
		private void HandleSelectionChanged (object sender, DPropertyValueChangedEventArgs<Selection> e)
		{	
			if (e.OldValue != null) {
				e.OldValue.GetProperty ("Position").DependencyPropertyValueChanged -= HandleSelectionChanged;
				e.OldValue.GetProperty ("SelectedToken").DependencyPropertyValueChanged -= HandleSelectionChanged;
				e.OldValue.GetProperty ("Type").DependencyPropertyValueChanged -= HandleSelectionChanged;
			}

			if (e.NewValue != null) {
				e.NewValue.GetProperty ("Position").DependencyPropertyValueChanged += HandleSelectionChanged;
				e.NewValue.GetProperty ("SelectedToken").DependencyPropertyValueChanged += HandleSelectionChanged;
				e.NewValue.GetProperty ("Type").DependencyPropertyValueChanged += HandleSelectionChanged;
			}
		}
 private void HandlePropertyValueChanged(object sender, DPropertyValueChangedEventArgs e)
 {
     Property = (e.NewValue as DependencyObject).GetProperty(PropertyName);
 }
Beispiel #21
0
		private void HandleSelectedTokenChanged (object sender, DPropertyValueChangedEventArgs<Token> e)
		{
			Position = 0;
		}
Beispiel #22
0
 private void HandleTargetValueChanged(object sender, DPropertyValueChangedEventArgs e)
 {
     UpdateSourceValue();
 }
		private void HandlePropertyValueChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			if (e.OldValue is IAttachedPropertiesContainer) {
				var oldContainer = e.OldValue as IAttachedPropertiesContainer;

				if (oldContainer != null) {	
					oldContainer.AddedItem += HandleAddedItem;
					oldContainer.RemovedItem += HandleRemovedItem;
				}
			}

			var container = e.NewValue as IAttachedPropertiesContainer;

			if (container != null) {
				Property = container.GetProperty (Item, PropertyName);

				container.AddedItem += HandleAddedItem;
				container.RemovedItem += HandleRemovedItem;
			} else {
				Property = null;
			}
		}
		private void HandleTargetValueChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			UpdateSourceValue ();
		}
		private void HandleIsOpenChanged (object sender, DPropertyValueChangedEventArgs<bool> e)
		{
			if (e.NewValue) {
				RaiseOpened ();

				Mouse.Captured = this;
			} else {
				RaiseClosed ();

				Mouse.Captured = null;
			}

		}
		private void HandleNeedToEvaluateChanged (object sender, DPropertyValueChangedEventArgs<bool> e)
		{
			if (!e.NewValue)
				return;

			var resultToken = Root.Tokens.OfType<ResultToken> ().FirstOrDefault ();

			if (resultToken == null)
				return;

			resultToken.Child = new TextToken ();
		}	
		private void ItemsSourceChanged (object sender, DPropertyValueChangedEventArgs<IEnumerable> e)
		{	
			if (e.OldValue is INotifyCollectionChanged)
				(e.NewValue as INotifyCollectionChanged).CollectionChanged -= HandleItemSourceCollectionChanged;
			
			foreach (var o in e.NewValue) {
				var child = ItemTemplate.LoadContent (o);

				Items.Add (new ItemView () { Item = o, Visual = child });
			}

			if (e.NewValue is INotifyCollectionChanged) 
				(e.NewValue as INotifyCollectionChanged).CollectionChanged += HandleItemSourceCollectionChanged;
		}
		private void HandlePropertyValueChanged (object sender, DPropertyValueChangedEventArgs<object> e)
		{
			IsMatch = (e.NewValue == null) ? Value == null : e.NewValue.Equals (Value);
		}
		private void HandleIsOpenChanged (object sender, DPropertyValueChangedEventArgs<bool> e)
		{
			if (e.NewValue)
				RaiseOpened ();
			else
				RaiseClosed ();
		}
Beispiel #30
0
		private void HandleSelectionChanged (object sender, DPropertyValueChangedEventArgs e)
		{
			RenderRoot ();
		}