private static void onEventNameChanged(RippleMouseTrackerOLD e, DPChangedEventArgs <string> args) { if (e.SourceObject != null && !e.EventName.IsNullOrWhiteSpace()) { e.registerEventHandler(e.SourceObject, e.EventName); } }
private static void onSwatchChanged( DependencyObject @this, DPChangedEventArgs <SwatchClassifier> args) { var swatch = GlobalResources .Palette .GetSwatch( args.NewValue); SetTheme(@this, swatch); }
private static void onAnimationTemplateChanged(IterativeReaction i, DPChangedEventArgs <AnimationTemplate> e) { if (e.OldValue != null) { e.OldValue.Detach(); } if (e.NewValue != null) { i.attachAssociatedChildElement(); } }
private static void onCompensateForWindowsToolbarChanged( DependencyObject @this, DPChangedEventArgs <bool> args) { var _pageOrientation = GetOrientation(@this); var _compensateForWindowsToolbar = GetCompensateForWindowsToolbar(@this); var _viewport = GetViewport(@this); onPageLayoutCompute( @this, _viewport, _pageOrientation, _compensateForWindowsToolbar); }
private static void onPlacementChanged( DependencyObject @this, DPChangedEventArgs <Point> args) { var translateTransform = @this as TranslateTransform; if (translateTransform == null) { return; } translateTransform.X = args.NewValue.X; translateTransform.Y = args.NewValue.Y; }
private static void onIdentityChanged( DependencyObject @this, DPChangedEventArgs <MaterialIdentity> args) { if (args.NewValue != null) { if (!_registeredIdentities.ContainsKey(args.NewValue)) { _registeredIdentities.Add( args.NewValue, @this.As <SolidColorBrush>()); } } }
private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs <double> e) { FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset; if (i.PART_scroll == null || i.PART_root == null) { i.applyZoomOffsetOnTemplate = true; } else { i.applyZoomOffsetOnTemplate = false; var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2, i.PART_scroll.ViewportHeight / 2); i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root); } }
private static void onAttachPropertyChanged( DependencyObject @this, DPChangedEventArgs <bool> args) { var window = @this.AsOrDefault <Window>(); if (window == null) { throw new NotSupportedException( $"The {nameof(AttachProperty).SQuote()} attached property can only be used on the " + $"type {nameof(Window).SQuote()}."); } if (args.NewValue) { window .CommandBindings .Add( new CommandBinding( SystemCommands.CloseWindowCommand, OnCloseWindow)); window .CommandBindings .Add( new CommandBinding( SystemCommands.MaximizeWindowCommand, OnMaximizeWindow, OnCanResizeWindow)); window .CommandBindings .Add( new CommandBinding( SystemCommands.MinimizeWindowCommand, OnMinimizeWindow, OnCanMinimizeWindow)); window .CommandBindings .Add( new CommandBinding( SystemCommands.RestoreWindowCommand, OnRestoreWindow, OnCanResizeWindow)); } }
private static void onValidatorChanged( DependencyObject @this, DPChangedEventArgs <IStringValidator> args) { var frameworkElement = @this.AsOrDefault <FrameworkElement>(); if (frameworkElement == null) { throw new ArgumentException( $"The service \'HintAssist.Validator\' can only be used with elements that inherit " + $"from the \'FrameworkElement\' type."); } var managerService = frameworkElement.GetTextFieldInputVisualStateService(); managerService?.EvaluateValidationState(frameworkElement); }
//private static bool shadowLevelPropertyValidator( // double? value) //{ // if (!value.HasValue) // return true; // return value.Value >= 0; //} private static void onShadowLevelChanged( DependencyObject @this, DPChangedEventArgs <double?> args) { if (@this is UIElement uiElement) { if (args.NewValue >= 0) { var shadow = getDropShadowEffect(args.NewValue.Value);//ShadowInterpolator.Interpolate(args.NewValue.Value); uiElement.Effect = shadow; } else { uiElement.Effect = null; } } }
// TODO find a better way to ensure render() call corresponds with animation and bar rendering states, defaults, etc. // TODO if bars are shoinwg -> first collapse, then render pass, then reveal animation public override void OnDataChanged(DPChangedEventArgs <DoubleSeries> e) { var oldValueValid = IsValidGraphData(e.OldValue); var newValueValid = IsValidGraphData(e.NewValue); if (oldValueValid) { // good -> good if (newValueValid) { //TODO check new and old datasets to see if number of columbns is different. if so, may... // TODO ...require background visuals for bars to animate to correct number. BeginCollapseAnimation(); var dispatcherTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(1000) }; dispatcherTimer.Tick += (s, a) => { s.RequireType <DispatcherTimer>().Stop(); //pc.animationState = AnimationState.Final; InvalidateMeasure(); InvalidateVisual(); BeginRevealAnimation(); }; dispatcherTimer.Start(); //TODO fadeout first } else { BeginCollapseAnimation(); } } else { if (newValueValid) { animationState = AnimationState.Final; InvalidateVisual(); BeginRevealAnimation(); } } base.OnDataChanged(e); }
private static void OnProviderServiceChanged( DependencyObject @this, DPChangedEventArgs <UserInputNuanceProviderService> args) { if (!(@this is FrameworkElement frameworkElement)) { throw new NotSupportedException( $"The \'UserInputNuanceInjector.NuanceProviderService\' property cannot be set on the " + $"element type \'{@this.GetType().Name}\' because \'HostedElement<TElement>\'-based " + $"services require the host element to derive from \'FrameworkElement\'."); } var newService = args.NewValue; var oldService = args.OldValue; newService?.DetachHost(); oldService?.AttachHost(frameworkElement); }
private static void onTextFieldInputVisualStateServiceChanged( DependencyObject @this, DPChangedEventArgs <TextFieldInputVisualStateService> args) { var visualStateManagerService = args.NewValue; var frameworkInputElement = @this.AsOrDefault <IFrameworkInputElement>(); if (frameworkInputElement == null) { throw new ArgumentException( $"The service \'HintAssist.TextFieldInputVisualStateService\' can only be used " + $"with elements that implement the \'IFrameworkInputElement\' interface."); } visualStateManagerService .AttachElement( frameworkInputElement); }
private static void onTrackingServiceChanged( DependencyObject @this, DPChangedEventArgs <RippleMouseTracker> args) { var frameworkElement = @this as FrameworkElement; if (frameworkElement == null) { throw new NotSupportedException( $"The \'RippleAssist.InputTrackingService\' property cannot be set on the " + $"element type \'{@this.GetType().Name}\' because \'HostedElement<TElement>\'-based" + $"services require the host element to derive from \'FrameworkElement\'."); } var newTrackingService = args.NewValue; var oldTrackingService = args.OldValue; oldTrackingService?.DetachHost(); newTrackingService?.AttachHost(frameworkElement); }
//protected override void OnDetaching() //{ // base.OnDetaching(); // if (Emitter != null) // { // Emitter.Detach(); // } //} private static void onEmittersChanged(AnimationTemplate i, DPChangedEventArgs <AnimationEmitterCollection> e) { if (e.OldValue == e.NewValue) { return; } if (e.OldValue != null && e.OldValue.IsAssociated) { e.OldValue.Detach(); } if (e.NewValue == null || i == null) { return; } if (e.NewValue.IsAssociated) { throw new InvalidOperationException("ExceptionStringTable.CannotHostBehaviorCollectionMultipleTimesExceptionMessage"); } e.NewValue.Attach(i); }
private static void IsDimmedChanged(MaterialDimmer i, DPChangedEventArgs<bool> e) { if (e.NewValue) { i.IsHitTestVisible = true; i._rectangle.BeginAnimation(OpacityProperty, new DoubleAnimation(i.DimPercent, new Duration(TimeSpan.FromMilliseconds(200))) { AccelerationRatio = AnimationParameters.AccelerationRatio, DecelerationRatio = AnimationParameters.DecelerationRatio }); } else { i.IsHitTestVisible = false; i._rectangle.BeginAnimation(OpacityProperty, new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(200))) { AccelerationRatio = AnimationParameters.AccelerationRatio, DecelerationRatio = AnimationParameters.DecelerationRatio }); } }
private static void IsDimmedChanged(MaterialDimmer i, DPChangedEventArgs <bool> e) { if (e.NewValue) { i.IsHitTestVisible = true; i._rectangle.BeginAnimation(OpacityProperty, new DoubleAnimation(i.DimPercent, new Duration(TimeSpan.FromMilliseconds(200))) { AccelerationRatio = AnimationParameters.AccelerationRatio, DecelerationRatio = AnimationParameters.DecelerationRatio }); } else { i.IsHitTestVisible = false; i._rectangle.BeginAnimation(OpacityProperty, new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(200))) { AccelerationRatio = AnimationParameters.AccelerationRatio, DecelerationRatio = AnimationParameters.DecelerationRatio }); } }
private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs<FlexDocument> e) { i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom; i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent)); }
public virtual void OnDataFiltered(DPChangedEventArgs <T> e) { }
private static void onForceCapitalizeTextChanged( DependencyObject @this, DPChangedEventArgs <bool> args) { if (args.NewValue) { switch (@this) { case TextBlock textBlock: textBlock.TextInput += onTextInput; break; case TextBox textbox: textbox.TextInput += onTextInput; textbox.TextChanged += onTextChanged; break; case Button button: { var descriptor = DependencyPropertyDescriptor .FromProperty( Button.ContentProperty, typeof(Button)); descriptor?.AddValueChanged( button, onButtonContentChanged); break; } case Label label: { var descriptor = DependencyPropertyDescriptor .FromProperty( Label.ContentProperty, typeof(Label)); descriptor?.AddValueChanged( label, onLabelContentChanged); break; } } } else { switch (@this) { case TextBlock textBlock: textBlock.TextInput -= onTextInput; break; case TextBox textbox: textbox.TextInput -= onTextInput; textbox.TextChanged -= onTextChanged; break; case Button button: { var descriptor = DependencyPropertyDescriptor .FromProperty( Button.ContentProperty, typeof(Button)); descriptor?.RemoveValueChanged( button, onButtonContentChanged); break; } case Label label: { var descriptor = DependencyPropertyDescriptor .FromProperty( Label.ContentProperty, typeof(Label)); descriptor?.RemoveValueChanged( label, onLabelContentChanged); break; } } } }
private static void DataChangedCallback(AbstractFlexChart <T> i, DPChangedEventArgs <T> e) { i.FilteredData = i.DataFilter.Filter(i.DataSorter.Sort(e.NewValue)); i.OnDataChanged(e); }
private static void DataFilteredCallback(AbstractFlexChart <T> i, DPChangedEventArgs <T> e) { i.OnDataFiltered(e); }
private static void onTargetObjectChanged(MethodCallReaction i, DPChangedEventArgs <DependencyObject> e) { i.ResolveMethodTarget(); }
private static void onThemeChanged( DependencyObject @this, DPChangedEventArgs <Swatch> args) { }
private static void SourceFileChanged(XMLTextEditor i, DPChangedEventArgs <FileInfo> e) { i.colorize(); }
private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs<FileInfo> e) { i.loadDocument(e.NewValue); }
//private static void onSourceObjectChanged(NewRippleTracker i, DPChangedEventArgs<object> e) //{ // i.updateTarget(); //} private static void onEventNameChanged(NewRippleTracker i, DPChangedEventArgs <string> e) { i.updateTarget(); }
private static void ActiveDirectoryChanged(FileManager i, DPChangedEventArgs<DirectoryInfo> e) { i.RaiseEvent(new RoutedEventArgs(DirectoryChangedEvent, e.NewValue)); FileManagerSettings.Instance.LastDirectory = e.NewValue.FullName; i.refresh(); }
private static void SourceFileChanged(XMLTextEditor i, DPChangedEventArgs<FileInfo> e) { i.colorize(); }
private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs <FileInfo> e) { i.loadDocument(e.NewValue); }
private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs <FlexDocument> e) { i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom; i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent)); }
private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs<double> e) { FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset; if (i.PART_scroll == null || i.PART_root == null) { i.applyZoomOffsetOnTemplate = true; } else { i.applyZoomOffsetOnTemplate = false; var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2, i.PART_scroll.ViewportHeight / 2); i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root); } }
private static void onTargetObjectChanged(ReactiveSetter i, DPChangedEventArgs <DependencyObject> e) { //i.resolveEffectiveTarget(); }
private static void onMethodNameChanged(MethodCallReaction i, DPChangedEventArgs <string> e) { i.ResolveMethodTarget(); //i._methodInfo = resolveMethodInfo(i.Target, i.MethodName); }
private static void DataSorterChanged(AbstractFlexChart <T> i, DPChangedEventArgs <DataSorter <T> > e) { i.FilteredData = i.DataFilter.Filter(i.DataSorter.Sort(i.Data)); }
private static void onTargetNameChanged(MethodCallReaction i, DPChangedEventArgs <string> e) { i._targetNameResolver.Name = e.NewValue; }
private static void OnTabsChanged(FlexDocument i, DPChangedEventArgs<ObservableCollection<FlexDocumentTab>> e) { i.resetDocument(); }