private void RestoreDataContext() { if (this.cachedDataContext == null) { return; } this.cachedDataContext.RestoreSceneViewAdorners(); this.cachedDataContext = (GradientBrushEditor)null; }
private void AddGradientStop(object sender, ExecutedRoutedEventArgs eventArgs) { GradientBrushEditor gradientBrushEditor = (GradientBrushEditor)this.DataContext; if (gradientBrushEditor == null) { return; } gradientBrushEditor.AddGradientStop((IInputElement)this, RoundingHelper.RoundScale((double)eventArgs.Parameter)); }
private void RestoreGradientStop(object sender, ExecutedRoutedEventArgs eventArgs) { GradientBrushEditor gradientBrushEditor = (GradientBrushEditor)this.DataContext; if (gradientBrushEditor == null) { return; } gradientBrushEditor.RestoreGradientStop((IInputElement)this); }
public void AddGradientStop(IInputElement sender, double offset) { SceneView defaultView = this.BasisProperty.SceneNodeObjectSet.ViewModel.DefaultView; object obj = this.gradientStopsProperty.GetValue(); GradientStopCollection gradientStops = (GradientStopCollection)defaultView.ConvertToWpfValue(obj); if (gradientStops == null) { gradientStops = new GradientStopCollection(); this.gradientStopsProperty.SetValue(defaultView.ConvertFromWpfValue((object)gradientStops)); } Color color = GradientBrushEditor.CalculateColor(gradientStops, offset); this.gradientStopsProperty.AddValue(defaultView.ConvertFromWpfValue((object)new GradientStop(color, offset))); this.RebuildModel(-1); }