source: extensions/PiwigoLib/PiwigoWpf/Helper/AppHelper.cs @ 7160

Last change on this file since 7160 was 7160, checked in by bayral, 14 years ago

Connection à partir de wpf

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.ComponentModel;
6using System.Windows;
7using System.Diagnostics.CodeAnalysis;
8
9namespace 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.