/// <summary>Updates the internal settings for the primary secondary brush</summary> private void SetInternalPrimaryAreaBackgroundBrush() { if (PrimaryAreaBackgroundBrush == null) { _primaryAreaBackgroundBrush = null; return; } _primaryAreaBackgroundBrush = PrimaryAreaBackgroundBrush.Clone(); _primaryAreaBackgroundBrush.Opacity = PrimaryAreaBackgroundBrushOpacity; if (PrimaryAreaBackgroundBrushLightFactor < .999d || PrimaryAreaBackgroundBrushLightFactor > 1.001d) { var converter = new LitBrushConverter(); _primaryAreaBackgroundBrush = converter.Convert(_primaryAreaBackgroundBrush, typeof(Brush), PrimaryAreaBackgroundBrushLightFactor, CultureInfo.InvariantCulture) as Brush; if (_primaryAreaBackgroundBrush != null) { _primaryAreaBackgroundBrush.Opacity = PrimaryAreaBackgroundBrushOpacity; } } }
/// <summary>Internal method used to set the background brush on a Grid object</summary> /// <param name="grid">The grid on which to set these values.</param> /// <param name="brush">The brush.</param> /// <param name="lightFactor">The light factor.</param> /// <param name="opacity">The opacity.</param> /// <remarks>Combines BackgroundBrush, BackgroundBrushLightFactor, and BackgroundBrushOpacity to set the Background property</remarks> private static void SetBackground(Panel grid, Brush brush, double lightFactor, double opacity) { if (brush == null) { return; } var brush2 = brush.CloneCurrentValue(); brush2.Opacity = opacity; if (lightFactor < .999d || lightFactor > 1.001d) { var converter = new LitBrushConverter(); brush2 = converter.Convert(brush2, typeof(Brush), lightFactor, CultureInfo.InvariantCulture) as Brush; if (brush2 != null) { brush2.Opacity = opacity; } } grid.Background = brush2; }