/// <summary> /// ContentProperty property changed handler. /// </summary> /// <param name="d">ContentControl that changed its Content.</param> /// <param name="e">DependencyPropertyChangedEventArgs.</param> private static void OnRightPropertyChanged (IDependencyObject d, DependencyPropertyChangedEventArgs e) { Canvas source = d as Canvas; Debug.Assert (source != null, "The source is not an instance of ContentControl!"); // Notify derived classes of the change source.OnRightChanged (e.OldValue, e.NewValue); }
private static void OnTriggersChanged(IDependencyObject obj, DependencyPropertyChangedEventArgs args) { var triggerCollection1 = args.OldValue as TriggerCollection; var triggerCollection2 = args.NewValue as TriggerCollection; if (triggerCollection1 == triggerCollection2) { return; } if (triggerCollection1 != null && triggerCollection1.AssociatedObject != null) { triggerCollection1.Detach(); } if (triggerCollection2 == null || obj == null) { return; } if (triggerCollection2.AssociatedObject != null) { throw new InvalidOperationException("Cannot attach TriggerCollection multiple imes"); } var fElement = obj as FormElement; if (fElement == null) { throw new InvalidOperationException("Can only host TriggerCollection on FormElement"); } triggerCollection2.Attach(fElement); }
/// <summary> /// Gets the TriggerCollection containing the triggers associated with the specified object. /// </summary> /// <param name="obj">The object from which to retrieve the triggers.</param> /// <returns> /// A TriggerCollection containing the triggers associated with the specified object. /// </returns> public static TriggerCollection GetTriggers(IDependencyObject obj) { var triggerCollection = (TriggerCollection) obj.GetValue(TriggersProperty); if (triggerCollection == null) { triggerCollection = new TriggerCollection(); obj.SetValue(TriggersProperty, triggerCollection); } return triggerCollection; }
/// <summary> /// Attaches the specified <see cref="MvvmFx.Windows.IDependencyObject"/> to the collection /// </summary> /// <param name="dependencyObject">The <see cref="MvvmFx.Windows.IDependencyObject"/> to attach</param> public void Attach(IDependencyObject dependencyObject) { if (dependencyObject == AssociatedObject) { return; } if (AssociatedObject != null) { throw new InvalidOperationException("Cannot attach TriggerAction multiple times"); } AssociatedObject = dependencyObject; OnAssociatedObjectChanged(); OnAttached(); }
public static void SetRow(IDependencyObject element, int value) { element.SetValue (RowProperty, value); }
public static int GetColumn(IDependencyObject element) { return (int) element.GetValue (ColumnProperty); }
public static void SetRowSpan(IDependencyObject element, object value) { element.SetValue(UIGrid.RowSpanProperty , value); }
public static void SetColumn(IDependencyObject element, object value) { element.SetValue(UIGrid.ColumnProperty , value); }
private static void OnRowColumnChanged( IDependencyObject o, DependencyPropertyChangedEventArgs e) { Console.WriteLine(o); Console.WriteLine(e.NewValue + " : " + e.OldValue + " , " + e.Property); }
// A .NET property wrapper (not must) public static int GetRow (IDependencyObject element){return (int)element.GetValue(UIGrid.RowProperty ); }
public static int GetColumn(IDependencyObject element) { return((int)element.GetValue(ColumnProperty)); }
public static void SetColumnSpan(IDependencyObject element, int value) { element.SetValue(ColumnSpanProperty, value); }
private static void OnTopPropertyChanged (IDependencyObject d, DependencyPropertyChangedEventArgs e) { var frame = d.Frame; frame.Y = float.Parse (e.NewValue.ToString ()); d.Frame = frame; }
public static int GetRowSpan(IDependencyObject element) { return((int)element.GetValue(RowSpanProperty)); }
public static void SetTop (IDependencyObject element, int value) { element.SetValue (Canvas.TopProperty, value); }
public static int GetTop (IDependencyObject element) { return (int)element.GetValue (Canvas.TopProperty); }
private static void OnRowColumnChanged( IDependencyObject o, DependencyPropertyChangedEventArgs e) { }
public static int GetRowSpan(IDependencyObject element) { return (int) element.GetValue (RowSpanProperty); }
public PropertyMetadata GetMetadata(IDependencyObject d) { if (metadataByType.ContainsKey (d.GetType())) return metadataByType[d.GetType()]; return null; }
public static void SetColumnSpan(IDependencyObject element, int value) { element.SetValue (ColumnSpanProperty, value); }
public PropertyMetadata GetMetadata(IDependencyObject dependencyObject) { if (dependencyObject != null) return GetMetadata(dependencyObject.GetType()); return null; }
/// <summary> /// Detaches the currently associated <see cref="MvvmFx.Windows.IDependencyObject"/> /// </summary> public void Detach() { OnDetaching(); AssociatedObject = null; OnAssociatedObjectChanged(); }
/// <summary> /// Retrieves the default value of the current <see cref="DependencyProperty"/>. /// </summary> /// <param name="owner">The onwer of the dependency property.</param> /// <returns>Retrieves the default value of the property.</returns> internal abstract new TProperty GetPropertyDefault(IDependencyObject owner);