private static void OnIsCheckedPropertyChanged( IReactiveObject source, ReactivePropertyChangeEventArgs <bool?> args) { var button = source as ToggleButton; if (button == null) { return; } bool?newValue = args.NewValue; if (newValue == true) { button.OnChecked(); } else if (newValue == false) { button.OnUnchecked(); } else { button.OnIndeterminate(); } }
private static void ItemsSourceChanged( IReactiveObject source, ReactivePropertyChangeEventArgs <IEnumerable> change) { var itemsControl = (ItemsControl)source; if (change.OldValue is INotifyCollectionChanged) { itemsControl.changingItems.Dispose(); } var observableCollection = change.NewValue as INotifyCollectionChanged; if (observableCollection != null) { itemsControl.changingItems = Observable.FromEventPattern <NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>( handler => new NotifyCollectionChangedEventHandler(handler), handler => observableCollection.CollectionChanged += handler, handler => observableCollection.CollectionChanged -= handler).Subscribe( itemsControl.OnNextItemChange); } itemsControl.isItemsSourceNew = true; itemsControl.InvalidateMeasure(); }
/// <summary> /// Invalidates the sender's Measure layout pass when a <see cref = "ReactiveProperty{T}">ReactiveProperty</see> value is changed. /// </summary> /// <typeparam name = "T">The type of the <see cref = "ReactiveProperty{T}">ReactiveProperty</see>.</typeparam> /// <param name = "sender">The ReactiveObject whose <see cref = "ReactiveProperty{T}">ReactiveProperty</see> has changed.</param> /// <param name = "args">An instance of <see cref = "ReactivePropertyChangeEventArgs{T}">ReactivePropertyChangeEventArgs</see> that carries information about the change.</param> public static void InvalidateMeasure <T>(IReactiveObject sender, ReactivePropertyChangeEventArgs <T> args) { var uiElement = sender as IElement; if (uiElement != null) { uiElement.InvalidateMeasure(); } }
private static void ChildPropertyChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs <IElement> change) { var border = (Border)source; border.InvalidateMeasure(); IElement oldChild = change.OldValue; if (oldChild != null) { oldChild.VisualParent = null; } IElement newChild = change.NewValue; if (newChild != null) { newChild.VisualParent = border; } }
private static void ContentPropertyChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs <IElement> change) { var contentControl = (ContentControl)source; contentControl.InvalidateMeasure(); IElement oldContent = change.OldValue; if (oldContent != null) { oldContent.VisualParent = null; } IElement newContent = change.NewValue; if (newContent != null) { newContent.VisualParent = contentControl; } contentControl.OnContentChanged(oldContent, newContent); }
private static void ItemsPanelChanged(IReactiveObject source, ReactivePropertyChangeEventArgs <Panel> change) { var itemsControl = (ItemsControl)source; Panel newPanel = change.NewValue; Panel oldPanel = change.OldValue; if (oldPanel != null) { oldPanel.VisualParent = null; } if (newPanel != null) { if (!(newPanel.Children is ITemplatedList <IElement>)) { throw new NotSupportedException( "ItemsControl requires a panel whose Children collection implements ITemplatedList<IElement>"); } newPanel.VisualParent = itemsControl; } itemsControl.InvalidateMeasure(); }
private static void WidthChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs<double> reactivePropertyChange) { ((TestBindingObject)source).widthPropertyChangedCalledbackCount++; }
private static void WidthChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs <double> reactivePropertyChange) { ((TestBindingObject)source).widthPropertyChangedCalledbackCount++; }
private static void DataContextChanged(IReactiveObject source, ReactivePropertyChangeEventArgs<object> args) { ((UIElement)source).InvalidateMeasureOnDataContextInheritors(); }
private static void ChildPropertyChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs<IElement> change) { var border = (Border)source; border.InvalidateMeasure(); IElement oldChild = change.OldValue; if (oldChild != null) { oldChild.VisualParent = null; } IElement newChild = change.NewValue; if (newChild != null) { newChild.VisualParent = border; } }
private static void WidthChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs <double> reactivePropertyChange) { ((TestBindingObject)source).WidthChangedCallback( reactivePropertyChange.OldValue, reactivePropertyChange.NewValue); }
private static void WidthChangedCallback( IReactiveObject source, ReactivePropertyChangeEventArgs<double> reactivePropertyChange) { ((TestBindingObject)source).WidthChangedCallback( reactivePropertyChange.OldValue, reactivePropertyChange.NewValue); }
private static void ItemsSourceChanged( IReactiveObject source, ReactivePropertyChangeEventArgs<IEnumerable> change) { var itemsControl = (ItemsControl)source; if (change.OldValue is INotifyCollectionChanged) { itemsControl.changingItems.Dispose(); } var observableCollection = change.NewValue as INotifyCollectionChanged; if (observableCollection != null) { itemsControl.changingItems = Observable.FromEventPattern<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>( handler => new NotifyCollectionChangedEventHandler(handler), handler => observableCollection.CollectionChanged += handler, handler => observableCollection.CollectionChanged -= handler).Subscribe( itemsControl.OnNextItemChange); } itemsControl.isItemsSourceNew = true; itemsControl.InvalidateMeasure(); }
private static void ItemsPanelChanged(IReactiveObject source, ReactivePropertyChangeEventArgs<Panel> change) { var itemsControl = (ItemsControl)source; Panel newPanel = change.NewValue; Panel oldPanel = change.OldValue; if (oldPanel != null) { oldPanel.VisualParent = null; } if (newPanel != null) { if (!(newPanel.Children is ITemplatedList<IElement>)) { throw new NotSupportedException( "ItemsControl requires a panel whose Children collection implements ITemplatedList<IElement>"); } newPanel.VisualParent = itemsControl; } itemsControl.InvalidateMeasure(); }
private static void OnIsCheckedPropertyChanged( IReactiveObject source, ReactivePropertyChangeEventArgs<bool?> args) { var button = source as ToggleButton; if (button == null) { return; } bool? newValue = args.NewValue; if (newValue == true) { button.OnChecked(); } else if (newValue == false) { button.OnUnchecked(); } else { button.OnIndeterminate(); } }