Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using System.ComponentModel; |
---|
6 | using System.Windows; |
---|
7 | using System.Diagnostics.CodeAnalysis; |
---|
8 | |
---|
9 | namespace Com.Piwigo.Wpf.Helper |
---|
10 | { |
---|
11 | public class AppHelper |
---|
12 | { |
---|
13 | private static bool? _isInDesignMode; |
---|
14 | |
---|
15 | /// <summary> |
---|
16 | /// Gets a value indicating whether the control is in design mode (running in Blend |
---|
17 | /// or Visual Studio). |
---|
18 | /// </summary> |
---|
19 | public static bool IsInDesignModeStatic |
---|
20 | { |
---|
21 | get |
---|
22 | { |
---|
23 | if (!_isInDesignMode.HasValue) |
---|
24 | { |
---|
25 | var prop = DesignerProperties.IsInDesignModeProperty; |
---|
26 | _isInDesignMode |
---|
27 | = (bool)DependencyPropertyDescriptor |
---|
28 | .FromProperty(prop, typeof(FrameworkElement)) |
---|
29 | .Metadata.DefaultValue; |
---|
30 | } |
---|
31 | |
---|
32 | return _isInDesignMode.Value; |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | /// <summary> |
---|
37 | /// Gets a value indicating whether the control is in design mode (running under Blend |
---|
38 | /// or Visual Studio). |
---|
39 | /// </summary> |
---|
40 | [SuppressMessage( |
---|
41 | "Microsoft.Performance", |
---|
42 | "CA1822:MarkMembersAsStatic", |
---|
43 | Justification = "Non static member needed for data binding")] |
---|
44 | public bool IsInDesignMode |
---|
45 | { |
---|
46 | get |
---|
47 | { |
---|
48 | return IsInDesignModeStatic; |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | } |
---|
53 | |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.