Skip to content

Commit

Permalink
WPF0016: Default value is shared reference type.
Browse files Browse the repository at this point in the history
Suppress WPF0036: Avoid side effects in CLR accessors.
  • Loading branch information
punker76 committed Feb 4, 2018
1 parent 094f61c commit fe1057f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/MahApps.Metro/MahApps.Metro.Shared/Controls/MetroWindow.cs
Expand Up @@ -96,16 +96,16 @@ public class MetroWindow : Window
public static readonly DependencyProperty IgnoreTaskbarOnMaximizeProperty = DependencyProperty.Register("IgnoreTaskbarOnMaximize", typeof(bool), typeof(MetroWindow), new PropertyMetadata(false));
public static readonly DependencyProperty FlyoutsProperty = DependencyProperty.Register("Flyouts", typeof(FlyoutsControl), typeof(MetroWindow), new PropertyMetadata(null, UpdateLogicalChilds));
public static readonly DependencyProperty WindowTransitionsEnabledProperty = DependencyProperty.Register("WindowTransitionsEnabled", typeof(bool), typeof(MetroWindow), new PropertyMetadata(true));
public static readonly DependencyProperty MetroDialogOptionsProperty = DependencyProperty.Register("MetroDialogOptions", typeof(MetroDialogSettings), typeof(MetroWindow), new PropertyMetadata(new MetroDialogSettings()));
public static readonly DependencyProperty MetroDialogOptionsProperty = DependencyProperty.Register("MetroDialogOptions", typeof(MetroDialogSettings), typeof(MetroWindow), new PropertyMetadata(default(MetroDialogSettings)));

public static readonly DependencyProperty WindowTitleBrushProperty = DependencyProperty.Register("WindowTitleBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(Brushes.Transparent));
public static readonly DependencyProperty NonActiveWindowTitleBrushProperty = DependencyProperty.Register("NonActiveWindowTitleBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(Brushes.Gray));
public static readonly DependencyProperty NonActiveBorderBrushProperty = DependencyProperty.Register("NonActiveBorderBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(Brushes.Gray));

public static readonly DependencyProperty GlowBrushProperty = DependencyProperty.Register("GlowBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(null));
public static readonly DependencyProperty NonActiveGlowBrushProperty = DependencyProperty.Register("NonActiveGlowBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(153, 153, 153)))); // #999999
public static readonly DependencyProperty NonActiveGlowBrushProperty = DependencyProperty.Register("NonActiveGlowBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(null));

public static readonly DependencyProperty OverlayBrushProperty = DependencyProperty.Register("OverlayBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(new SolidColorBrush(Color.FromScRgb(255, 0, 0, 0)))); // BlackColorBrush
public static readonly DependencyProperty OverlayBrushProperty = DependencyProperty.Register("OverlayBrush", typeof(Brush), typeof(MetroWindow), new PropertyMetadata(null));
public static readonly DependencyProperty OverlayOpacityProperty = DependencyProperty.Register("OverlayOpacity", typeof(double), typeof(MetroWindow), new PropertyMetadata(0.7d));

/// <summary>
Expand Down Expand Up @@ -957,11 +957,18 @@ public void ResetStoredFocus()
restoreFocus = null;
}

static MetroWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MetroWindow), new FrameworkPropertyMetadata(typeof(MetroWindow)));
}

/// <summary>
/// Initializes a new instance of the MahApps.Metro.Controls.MetroWindow class.
/// </summary>
public MetroWindow()
{
this.MetroDialogOptions = new MetroDialogSettings();

DataContextChanged += MetroWindow_DataContextChanged;
Loaded += this.MetroWindow_Loaded;

Expand Down Expand Up @@ -1204,11 +1211,6 @@ protected override IEnumerator LogicalChildren
}
}

static MetroWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MetroWindow), new FrameworkPropertyMetadata(typeof(MetroWindow)));
}

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
Expand Down
3 changes: 2 additions & 1 deletion src/MahApps.Metro/MahApps.Metro/Properties/AssemblyInfo.cs
Expand Up @@ -21,4 +21,5 @@
[assembly: AssemblyProduct("MahApps.Metro 1.6.0")]

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("WpfAnalyzers.DependencyProperty", "WPF0006:Name of CoerceValueCallback should match registered name.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("WpfAnalyzers.DependencyProperty", "WPF0007:Name of ValidateValueCallback should match registered name.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("WpfAnalyzers.DependencyProperty", "WPF0007:Name of ValidateValueCallback should match registered name.")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("WpfAnalyzers.DependencyProperty", "WPF0036:Avoid side effects in CLR accessors.")]
1 change: 1 addition & 0 deletions src/MahApps.Metro/MahApps.Metro/Themes/MetroWindow.xaml
Expand Up @@ -572,6 +572,7 @@
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
<Setter Property="NonActiveBorderBrush" Value="{DynamicResource NonActiveBorderColorBrush}" />
<Setter Property="NonActiveWindowTitleBrush" Value="{DynamicResource NonActiveWindowTitleColorBrush}" />
<Setter Property="NonActiveGlowBrush" Value="{DynamicResource BlackColorBrush}" />
<Setter Property="OverlayBrush" Value="{DynamicResource BlackColorBrush}" />
<Setter Property="OverlayFadeIn" Value="{StaticResource OverlayFastSemiFadeIn}" />
<Setter Property="OverlayFadeOut" Value="{StaticResource OverlayFastSemiFadeOut}" />
Expand Down

0 comments on commit fe1057f

Please sign in to comment.