public void OnClickedRadial(object sender, ClickedEventArgs args) { GradientVisual gradientVisualMap1 = new GradientVisual(); PropertyArray stopColor = new PropertyArray(); stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f)); stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f)); gradientVisualMap1.Center = new Vector2(0.0f, 0.0f); gradientVisualMap1.Radius = 0.5f; gradientVisualMap1.StopColor = stopColor; gradientVisualMap1.Origin = Visual.AlignType.TopBegin; BrushViewer.RemoveVisual("linearGradient"); BrushViewer.AddVisual("radialGradient", gradientVisualMap1); }
public void OnClickedLinear(object sender, ClickedEventArgs args) { ///Create new visual view and gradient visual instances GradientVisual gradientVisualMap1 = new GradientVisual(); PropertyArray stopColor = new PropertyArray(); stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f)); stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f)); gradientVisualMap1.StartPosition = new Vector2(0.0f, 0.0f); gradientVisualMap1.EndPosition = new Vector2(0.3f, 0.3f); gradientVisualMap1.StopColor = stopColor; gradientVisualMap1.Origin = Visual.AlignType.TopBegin; BrushViewer.RemoveVisual("radialGradient"); BrushViewer.AddVisual("linearGradient", gradientVisualMap1); }
public void OnClickedSolid(object sender, ClickedEventArgs args) { BrushViewer.RemoveVisual("radialGradient"); BrushViewer.RemoveVisual("linearGradient"); BrushViewer.BackgroundColor = new Color(1f, 0f, 0f, 1f); }