├── .gitignore
├── Assemblies
└── WPFToolkit.dll
├── LICENSE
├── LocalTestRun.testrunconfig
├── Main
├── WpfPropertyGrid.Themes
│ ├── Kaxaml.cs
│ ├── Kaxaml
│ │ ├── IndexingStackPanel.cs
│ │ ├── Reveal.cs
│ │ └── Theme.xaml
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WpfPropertyGrid.Themes.csproj
│ └── WpfPropertyGrid.snk
└── WpfPropertyGrid
│ ├── CategoryEditor.cs
│ ├── CategoryItem.cs
│ ├── Controls
│ ├── DoubleEditor.cs
│ ├── EnumDropdown.cs
│ ├── SearchTextBox.cs
│ └── SliderEditorBase.cs
│ ├── Converters
│ ├── DebugConverter.cs
│ ├── EnumValueConverter.cs
│ ├── ExpanderHeaderWidthConverter.cs
│ ├── FontConverterDecorator.cs
│ ├── FontStretchConverterDecorator.cs
│ ├── FontStyleConverterDecorator.cs
│ ├── FontWeightConverterDecorator.cs
│ ├── MultiBooleanToVisibilityConverter.cs
│ └── NullValueConverter.cs
│ ├── CustomDictionary.xml
│ ├── DataResource.cs
│ ├── Design
│ ├── AlphabeticalLayout.cs
│ ├── AlphabeticalLayout.xaml
│ ├── CategorizedLayout.cs
│ ├── CategorizedLayout.xaml
│ ├── CategoryContainer.cs
│ ├── CategoryEditorContentPresenter.cs
│ ├── CategoryItemsLayout.cs
│ ├── ExtendedPropertyEditorTab.cs
│ ├── GridEntryContainer.cs
│ ├── GridEntryLayout.cs
│ ├── PropertyContainer.cs
│ ├── PropertyEditorContentPresenter.cs
│ ├── PropertyItemsLayout.cs
│ ├── PropertyNameTextBlock.cs
│ ├── TabbedLayout.cs
│ ├── TabbedLayout.xaml
│ ├── TabbedLayoutItem.cs
│ └── TabbedLayoutTemplateSelector.cs
│ ├── Editor.cs
│ ├── EditorCollection.cs
│ ├── EditorKeys.cs
│ ├── GridEntry.cs
│ ├── GridEntryCollection.cs
│ ├── Input
│ ├── PropertyEditorCommands.cs
│ └── PropertyGridCommands.cs
│ ├── Internal
│ ├── MathUtil.cs
│ └── MergedPropertyDescriptor.cs
│ ├── KnownTypes.cs
│ ├── License.txt
│ ├── Metadata
│ ├── AttributesContainer.cs
│ ├── BrowsableCategoryAttribute.cs
│ ├── BrowsablePropertyAttribute.cs
│ ├── CategoryEditorAttribute.cs
│ ├── CategoryOrderAttribute.cs
│ ├── FlatternHierarchyAttribute.cs
│ ├── NumberRangeAttribute.cs
│ ├── PropertyEditorAttribute.cs
│ └── PropertyOrderAttribute.cs
│ ├── MetadataRepository.cs
│ ├── ObjectServices.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── PropertyDisplayMode.cs
│ ├── PropertyEditing
│ ├── CategoryItemComparer.cs
│ ├── Filters
│ │ ├── IPropertyFilterTarget.cs
│ │ ├── PropertyFilter.cs
│ │ ├── PropertyFilterAppliedEventArgs.cs
│ │ └── PropertyFilterPredicate.cs
│ ├── NamedColor.cs
│ ├── NamedColorList.cs
│ ├── PropertyItemComparer.cs
│ ├── ValueExceptionEventArgs.cs
│ └── ValueExceptionSource.cs
│ ├── PropertyEditingEventArgs.cs
│ ├── PropertyEditor.cs
│ ├── PropertyGrid.Commands.cs
│ ├── PropertyGrid.cs
│ ├── PropertyGridUtils.cs
│ ├── PropertyItem.cs
│ ├── PropertyItemValue.cs
│ ├── PropertyValueChangedEventArgs.cs
│ ├── ResourceLocator.cs
│ ├── Themes
│ ├── DoubleEditor.xaml
│ ├── EditorResources.xaml
│ ├── Generic.xaml
│ ├── Images
│ │ ├── clear.png
│ │ └── search.png
│ ├── PropertyGrid.xaml
│ └── SearchTextBox.xaml
│ ├── TypeEditor.cs
│ ├── Utils
│ ├── PasswordBoxExtender.cs
│ └── TextBoxExtender.cs
│ ├── ValueEditors
│ └── EditorResources.xaml
│ ├── WpfPropertyGrid.csproj
│ └── WpfPropertyGrid.snk
├── README
├── README.md
├── Samples
├── WPG.BrushCategory
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WPG.BrushCategory.csproj
│ ├── Window1.xaml
│ └── Window1.xaml.cs
├── WPG.CategoryEditor
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BusinessObject.cs
│ ├── EditorKeys.cs
│ ├── FontList.cs
│ ├── FontSizeList.cs
│ ├── FontStyleConverter.cs
│ ├── FontWeightConverter.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WPG.CategoryEditor.csproj
│ ├── Window1.xaml
│ └── Window1.xaml.cs
├── WPG.ComplexProperty
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Female.cs
│ ├── Human.cs
│ ├── Male.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WPG.ComplexProperty.csproj
│ ├── Window1.xaml
│ └── Window1.xaml.cs
├── WPG.CustomTypeEditors
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BusinessObject.cs
│ ├── Converters
│ │ ├── DefaultPercentConverter.cs
│ │ └── EmptyValueConverter.cs
│ ├── CustomCategories
│ │ ├── FontList.cs
│ │ ├── FontSizeList.cs
│ │ ├── FontStyleConverter.cs
│ │ └── FontWeightConverter.cs
│ ├── LocalResources.cs
│ ├── MyEditors
│ │ ├── FileBrowserDialogPropertyValueEditor.cs
│ │ ├── OpenFileDialogOptionsAttribute.cs
│ │ └── PointEditor.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WPG.CustomTypeEditors.csproj
│ ├── Window1.xaml
│ ├── Window1.xaml.cs
│ └── XmlLanguageList.cs
├── WPG.DialogEditor
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BusinessObject.cs
│ ├── EditorKeys.cs
│ ├── FilePathPicker.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── WPG.DialogEditor.csproj
│ ├── Window1.xaml
│ └── Window1.xaml.cs
├── WPG.ExtendedEditor
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── ViewModel.cs
│ └── WPG.ExtendedEditor.csproj
├── WPG.Proxies
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── TextBoxProxy.cs
│ ├── WPG.Proxies.csproj
│ ├── Window1.xaml
│ └── Window1.xaml.cs
└── WPG.WindowsFormsIntegration
│ ├── BusinessObject.cs
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── WPG.WindowsFormsIntegration.csproj
├── Tests
└── WPG.UnitTests
│ ├── CategoryEditorTest.cs
│ ├── CategoryItemTest.cs
│ ├── Converters
│ ├── EnumValueConverterTest.cs
│ ├── ExpanderHeaderWidthConverterTest.cs
│ ├── FontStretchConverterDecoratorTest.cs
│ ├── FontStyleConverterDecoratorTest.cs
│ ├── FontWeightConverterDecoratorTest.cs
│ ├── MultiBooleanToVisibilityConverterTest.cs
│ └── NullValueConverterTest.cs
│ ├── Design
│ ├── AlphabeticalLayoutTest.cs
│ ├── CategorizedLayoutTest.cs
│ ├── CategoryContainerTest.cs
│ ├── CategoryEditorContentPresenterTest.cs
│ ├── CategoryItemsLayoutTest.cs
│ ├── GridEntryContainerTest.cs
│ ├── PropertyContainerTest.cs
│ ├── PropertyEditorContentPresenterTest.cs
│ ├── PropertyItemsLayoutTest.cs
│ ├── PropertyNameTextBlockTest.cs
│ └── TabbedLayoutTest.cs
│ ├── EditorCollectionTest.cs
│ ├── GridEntryCollectionTest.cs
│ ├── Internal
│ └── MathUtilTest.cs
│ ├── Metadata
│ ├── AttributesContainerTest.cs
│ ├── BrowsableCategoryAttributeTest.cs
│ ├── BrowsablePropertyAttributeTest.cs
│ ├── CategoryEditorAttributeTest.cs
│ ├── NumberRangeAttributeTest.cs
│ ├── PropertyEditorAttributeTest.cs
│ └── PropertyOrderAttributeTest.cs
│ ├── MetadataRepositoryTest.cs
│ ├── ObjectServicesTest.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── PropertyEditing
│ ├── CategoryItemComparerTest.cs
│ ├── Filters
│ │ ├── PropertyFilterPredicateTest.cs
│ │ └── PropertyFilterTest.cs
│ ├── NamedColorTest.cs
│ ├── PropertyItemComparerTest.cs
│ └── ValueExceptionEventArgsTest.cs
│ ├── PropertyEditorTest.cs
│ ├── PropertyFilterAppliedEventArgsTest.cs
│ ├── PropertyGridUtilsTest.cs
│ ├── PropertyItemTest.cs
│ ├── PropertyValueChangedEventArgsTest.cs
│ ├── TypeEditorTest.cs
│ ├── WPG.UnitTests.csproj
│ └── WpfPropertyGrid.snk
├── WpfPropertyGrid.sln
├── WpfPropertyGrid.vsmdi
└── WpfPropertyGrid1.vsmdi
/.gitignore:
--------------------------------------------------------------------------------
1 | *.user
2 | *.suo
3 | *.sln.cache
4 | *.pdb
5 | [bB]in/
6 | [oO]bj/
7 | TestResults/
8 | _ReSharper.*
9 | *.vssscc
10 | *.vspscc
--------------------------------------------------------------------------------
/Assemblies/WPFToolkit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Assemblies/WPFToolkit.dll
--------------------------------------------------------------------------------
/LocalTestRun.testrunconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 | This is a default test run configuration for a local test run.
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid.Themes/Kaxaml.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Windows.Markup;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid.Themes
19 | {
20 | public class KaxamlTheme : ResourceDictionary, IComponentConnector
21 | {
22 | private bool isInitialized;
23 |
24 | public static ComponentResourceKey StyleKey
25 | {
26 | get { return new ComponentResourceKey(typeof(KaxamlTheme), "Style"); }
27 | }
28 |
29 | public KaxamlTheme()
30 | {
31 | InitializeComponent();
32 | }
33 |
34 | #region IComponentConnector Members
35 |
36 | public void Connect(int connectionId, object target)
37 | {
38 | this.isInitialized = true;
39 | }
40 |
41 | public void InitializeComponent()
42 | {
43 | if (!isInitialized)
44 | {
45 | this.isInitialized = true;
46 | Uri resourceLocator = new Uri("/System.Windows.Controls.WpfPropertyGrid.Themes;component/Kaxaml/Theme.xaml", UriKind.Relative);
47 | Application.LoadComponent(this, resourceLocator);
48 | }
49 | }
50 |
51 | #endregion
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid.Themes/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 | using System.Windows.Markup;
7 |
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | [assembly: AssemblyTitle("WpfPropertyGrid.Themes")]
12 | [assembly: AssemblyDescription("Themes for WPF Property Grid")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("")]
15 | [assembly: AssemblyProduct("WpfPropertyGrid.Themes")]
16 | [assembly: AssemblyCopyright("Copyright © 2010-2011 Denys Vuika")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Setting ComVisible to false makes the types in this assembly not visible
21 | // to COM components. If you need to access a type in this assembly from
22 | // COM, set the ComVisible attribute to true on that type.
23 | [assembly: ComVisible(false)]
24 |
25 | //In order to begin building localizable applications, set
26 | //CultureYouAreCodingWith in your .csproj file
27 | //inside a . For example, if you are using US english
28 | //in your source files, set the to en-US. Then uncomment
29 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
30 | //the line below to match the UICulture setting in the project file.
31 |
32 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
33 |
34 |
35 | [assembly: ThemeInfo(
36 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
37 | //(used if a resource is not found in the page,
38 | // or application resource dictionaries)
39 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
40 | //(used if a resource is not found in the page,
41 | // app, or any theme specific resource dictionaries)
42 | )]
43 |
44 |
45 | // Version information for an assembly consists of the following four values:
46 | //
47 | // Major Version
48 | // Minor Version
49 | // Build Number
50 | // Revision
51 | //
52 | // You can specify all the values or you can default the Build and Revision Numbers
53 | // by using the '*' as shown below:
54 | // [assembly: AssemblyVersion("2010.5.*")]
55 | [assembly: AssemblyVersion("2010.11.10")]
56 | [assembly: AssemblyFileVersion("2010.11.10")]
57 |
58 | [assembly: XmlnsDefinition("http://schemas.denisvuyka.wordpress.com/wpfpropertygrid", "System.Windows.Controls.WpfPropertyGrid.Themes")]
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid.Themes/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace System.Windows.Controls.WpfPropertyGrid.Themes.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid.Themes/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid.Themes/WpfPropertyGrid.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Main/WpfPropertyGrid.Themes/WpfPropertyGrid.snk
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Converters/DebugConverter.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System;
18 | using System.Diagnostics;
19 | using System.Globalization;
20 | using System.Windows.Data;
21 |
22 | namespace System.Windows.Controls.WpfPropertyGrid
23 | {
24 | ///
25 | /// Value converter that can be used for editor debugging purposes.
26 | ///
27 | public class DebugConverter : IValueConverter
28 | {
29 | #region IValueConverter Members
30 |
31 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
32 | {
33 | Debugger.Break();
34 | return value;
35 | }
36 |
37 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
38 | {
39 | Debugger.Break();
40 | return value;
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Converters/FontStretchConverterDecorator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.ComponentModel;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid
20 | {
21 | ///
22 | /// Extended that provides standard values collection.
23 | ///
24 | public sealed class FontStretchConverterDecorator : FontConverterDecorator
25 | {
26 | ///
27 | /// Initializes a new instance of the class.
28 | ///
29 | public FontStretchConverterDecorator() : base(new FontStretchConverter()) { }
30 |
31 | ///
32 | /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
33 | ///
34 | /// An that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null.
35 | ///
36 | /// A that holds a standard set of valid values, or null if the data type does not support a standard set of values.
37 | ///
38 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
39 | {
40 | return new StandardValuesCollection(
41 | new[]
42 | {
43 | FontStretches.Condensed,
44 | FontStretches.Expanded,
45 | FontStretches.ExtraCondensed,
46 | FontStretches.ExtraExpanded,
47 | FontStretches.Normal,
48 | FontStretches.SemiCondensed,
49 | FontStretches.SemiExpanded,
50 | FontStretches.UltraCondensed,
51 | FontStretches.UltraExpanded
52 | });
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Converters/FontStyleConverterDecorator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.ComponentModel;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid
20 | {
21 | ///
22 | /// Extended that provides standard values collection.
23 | ///
24 | public sealed class FontStyleConverterDecorator : FontConverterDecorator
25 | {
26 | ///
27 | /// Initializes a new instance of the class.
28 | ///
29 | public FontStyleConverterDecorator() : base(new FontStyleConverter()) { }
30 |
31 | ///
32 | /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
33 | ///
34 | /// An that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null.
35 | ///
36 | /// A that holds a standard set of valid values, or null if the data type does not support a standard set of values.
37 | ///
38 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
39 | {
40 | return new StandardValuesCollection(
41 | new[]
42 | {
43 | FontStyles.Italic,
44 | FontStyles.Normal,
45 | FontStyles.Oblique
46 | });
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Converters/FontWeightConverterDecorator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.ComponentModel;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid
20 | {
21 | ///
22 | /// Extended that provides standard values collection.
23 | ///
24 | public class FontWeightConverterDecorator : FontConverterDecorator
25 | {
26 | ///
27 | /// Initializes a new instance of the class.
28 | ///
29 | public FontWeightConverterDecorator() : base(new FontWeightConverter()) { }
30 |
31 | ///
32 | /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context.
33 | ///
34 | /// An that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null.
35 | ///
36 | /// A that holds a standard set of valid values, or null if the data type does not support a standard set of values.
37 | ///
38 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
39 | {
40 | return new StandardValuesCollection(
41 | new[]
42 | {
43 | FontWeights.Thin,
44 | FontWeights.ExtraLight,
45 | FontWeights.Light,
46 | FontWeights.Normal,
47 | FontWeights.Medium,
48 | FontWeights.SemiBold,
49 | FontWeights.Bold,
50 | FontWeights.ExtraBold,
51 | FontWeights.Black,
52 | FontWeights.ExtraBlack });
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/CustomDictionary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Orbifold
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/AlphabeticalLayout.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid.Design
18 | {
19 | ///
20 | /// The default alphabetical view for properties.
21 | ///
22 | public class AlphabeticalLayout : Control
23 | {
24 | static AlphabeticalLayout()
25 | {
26 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AlphabeticalLayout), new FrameworkPropertyMetadata(typeof(AlphabeticalLayout)));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/AlphabeticalLayout.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
18 |
19 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/CategorizedLayout.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid.Design
18 | {
19 | ///
20 | /// The default categorized view for properties.
21 | ///
22 | public class CategorizedLayout : Control
23 | {
24 | static CategorizedLayout()
25 | {
26 | DefaultStyleKeyProperty.OverrideMetadata(typeof(CategorizedLayout), new FrameworkPropertyMetadata(typeof(CategorizedLayout)));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/CategorizedLayout.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
18 |
19 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/CategoryContainer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid
18 | {
19 | ///
20 | /// Specialized UI container for a category entry.
21 | ///
22 | public class CategoryContainer : GridEntryContainer
23 | {
24 | ///
25 | /// Initializes the class.
26 | ///
27 | static CategoryContainer()
28 | {
29 | DefaultStyleKeyProperty.OverrideMetadata(typeof(CategoryContainer), new FrameworkPropertyMetadata(typeof(CategoryContainer)));
30 | }
31 |
32 | ///
33 | /// Initializes a new instance of the class.
34 | ///
35 | public CategoryContainer()
36 | {
37 | SetParentContainer(this, this);
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/CategoryEditorContentPresenter.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.Windows.Data;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid.Design
20 | {
21 | ///
22 | /// Defines a content presenter control for a Category editor.
23 | ///
24 | public class CategoryEditorContentPresenter : ContentPresenter
25 | {
26 | ///
27 | /// Initializes a new instance of the class.
28 | ///
29 | public CategoryEditorContentPresenter()
30 | {
31 | var contentBinding = new Binding
32 | {
33 | RelativeSource = RelativeSource.Self,
34 | Path = new PropertyPath("(0).(1)", new[] { GridEntryContainer.ParentContainerProperty, GridEntryContainer.EntryProperty })
35 | };
36 |
37 | var contentTemplateBinding = new Binding
38 | {
39 | RelativeSource = RelativeSource.Self,
40 | Path = new PropertyPath("(0).EditorTemplate", new[] { GridEntryContainer.ParentContainerProperty })
41 | };
42 |
43 | SetBinding(ContentProperty, contentBinding);
44 | SetBinding(ContentTemplateProperty, contentTemplateBinding);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/CategoryItemsLayout.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid.Design
18 | {
19 | ///
20 | /// Specifies a layout for categories.
21 | ///
22 | public class CategoryItemsLayout : GridEntryLayout
23 | {
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/GridEntryLayout.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.Windows.Data;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid.Design
20 | {
21 | ///
22 | /// Defines a basement for GridEntry UI layouts (panels, lists, etc)
23 | ///
24 | /// The type of elements in the control.
25 | public abstract class GridEntryLayout : ItemsControl where T: GridEntryContainer, new()
26 | {
27 | ///
28 | /// Creates or identifies the element that is used to display the given item.
29 | ///
30 | ///
31 | /// The element that is used to display the given item.
32 | ///
33 | protected override DependencyObject GetContainerForItemOverride()
34 | {
35 | return new T();
36 | }
37 |
38 | ///
39 | /// Prepares the specified element to display the specified item.
40 | ///
41 | /// Element used to display the specified item.
42 | /// Specified item.
43 | protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
44 | {
45 | var container = element as T;
46 | if (container != null)
47 | {
48 | container.DataContext = item;
49 | container.SetBinding(GridEntryContainer.EntryProperty, new Binding());
50 | }
51 | base.PrepareContainerForItemOverride(element, item);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/PropertyContainer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid
18 | {
19 | ///
20 | /// Specialized UI container for a property entry.
21 | ///
22 | public class PropertyContainer : GridEntryContainer
23 | {
24 | ///
25 | /// Initializes the class.
26 | ///
27 | static PropertyContainer()
28 | {
29 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PropertyContainer), new FrameworkPropertyMetadata(typeof(PropertyContainer)));
30 | }
31 |
32 | ///
33 | /// Initializes a new instance of the class.
34 | ///
35 | public PropertyContainer()
36 | {
37 | SetParentContainer(this, this);
38 |
39 | //PreviewMouseDown+=(sender, args) => MessageBox.Show(Entry.Name);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/PropertyEditorContentPresenter.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | using System.Windows.Data;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid.Design
20 | {
21 | ///
22 | /// Defines a content presenter control for a Property editor.
23 | ///
24 | public sealed class PropertyEditorContentPresenter : ContentPresenter
25 | {
26 | ///
27 | /// Initializes a new instance of the class.
28 | ///
29 | public PropertyEditorContentPresenter()
30 | {
31 | var contentBinding = new Binding
32 | {
33 | RelativeSource = RelativeSource.Self,
34 | Path = new PropertyPath("(0).(1).PropertyValue", new[] { GridEntryContainer.ParentContainerProperty, GridEntryContainer.EntryProperty })
35 | };
36 |
37 | var contentTemplateBinding = new Binding
38 | {
39 | RelativeSource = RelativeSource.Self,
40 | Path = new PropertyPath("(0).EditorTemplate", new[] { GridEntryContainer.ParentContainerProperty })
41 | };
42 |
43 | SetBinding(ContentProperty, contentBinding);
44 | SetBinding(ContentTemplateProperty, contentTemplateBinding);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/PropertyItemsLayout.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid.Design
17 | {
18 | ///
19 | /// Specifies a layout for properties.
20 | ///
21 | public class PropertyItemsLayout : GridEntryLayout
22 | {
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/PropertyNameTextBlock.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Windows.Input;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid.Design
19 | {
20 | ///
21 | /// Specifies a property name presenter.
22 | ///
23 | public sealed class PropertyNameTextBlock : TextBlock
24 | {
25 | ///
26 | /// Initializes a new instance of the class.
27 | ///
28 | public PropertyNameTextBlock()
29 | {
30 | TextTrimming = TextTrimming.CharacterEllipsis;
31 | TextWrapping = TextWrapping.NoWrap;
32 | TextAlignment = TextAlignment.Right;
33 | VerticalAlignment = VerticalAlignment.Center;
34 | ClipToBounds = true;
35 |
36 | KeyboardNavigation.SetIsTabStop(this, false);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/TabbedLayoutItem.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace System.Windows.Controls.WpfPropertyGrid.Design
18 | {
19 | ///
20 | /// Native Tab item for
21 | ///
22 | public partial class TabbedLayoutItem : TabItem
23 | {
24 | ///
25 | /// Initializes the class.
26 | ///
27 | static TabbedLayoutItem()
28 | {
29 | DefaultStyleKeyProperty.OverrideMetadata(typeof(TabbedLayoutItem), new FrameworkPropertyMetadata(typeof(TabbedLayoutItem)));
30 | }
31 |
32 | ///
33 | /// Identifies the dependency property.
34 | ///
35 | public static readonly DependencyProperty CanCloseProperty =
36 | DependencyProperty.Register("CanClose", typeof(bool), typeof(TabbedLayoutItem), new PropertyMetadata(false));
37 |
38 | ///
39 | /// Gets or sets a value indicating whether this instance can close.
40 | ///
41 | /// true if this instance can close; otherwise, false.
42 | public bool CanClose
43 | {
44 | get { return (bool)GetValue(CanCloseProperty); }
45 | set { SetValue(CanCloseProperty, value); }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Design/TabbedLayoutTemplateSelector.cs:
--------------------------------------------------------------------------------
1 | namespace System.Windows.Controls.WpfPropertyGrid.Design
2 | {
3 | public class TabbedLayoutTemplateSelector : DataTemplateSelector
4 | {
5 | private readonly ResourceLocator _resourceLocator = new ResourceLocator();
6 |
7 | public override DataTemplate SelectTemplate(object item, DependencyObject container)
8 | {
9 | var category = item as CategoryItem;
10 | if (category != null)
11 | {
12 | var template = FindEditorTemplate(category);
13 | if (template != null) return template;
14 | }
15 |
16 | return base.SelectTemplate(item, container);
17 | }
18 |
19 | protected virtual DataTemplate FindEditorTemplate(CategoryItem category)
20 | {
21 | if (category == null) return null;
22 |
23 | var editor = category.Editor;
24 |
25 | if (editor == null) return null;
26 |
27 | var template = editor.InlineTemplate as DataTemplate;
28 | if (template != null) return template;
29 |
30 | return _resourceLocator.GetResource(editor.InlineTemplate) as DataTemplate;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Input/PropertyEditorCommands.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Windows.Input;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | ///Provides a standard set of property editor related commands.
22 | ///
23 | public static class PropertyEditorCommands
24 | {
25 | private static readonly Type ThisType = typeof(PropertyEditorCommands);
26 |
27 | private static readonly RoutedUICommand _ShowDialogEditor = new RoutedUICommand("Show Dialog Editor", "ShowDialogEditorCommand", ThisType);
28 | private static readonly RoutedUICommand _ShowExtendedEditor = new RoutedUICommand("Show Extended Editor", "ShowExtendedEditorCommand", ThisType);
29 |
30 | ///
31 | /// Defines a command to show dialog editor for a property.
32 | ///
33 | public static RoutedUICommand ShowDialogEditor
34 | {
35 | get { return _ShowDialogEditor; }
36 | }
37 |
38 | ///
39 | /// Defines a command to show extended editor for a property.
40 | ///
41 | public static RoutedUICommand ShowExtendedEditor
42 | {
43 | get { return _ShowExtendedEditor; }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Metadata/CategoryOrderAttribute.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Specifies the order of category.
20 | ///
21 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
22 | public sealed class CategoryOrderAttribute : Attribute
23 | {
24 | ///
25 | /// Gets the category name.
26 | ///
27 | public string Category { get; private set; }
28 |
29 | ///
30 | /// Gets the category order.
31 | ///
32 | /// The order.
33 | public int Order { get; private set; }
34 |
35 | ///
36 | /// Initializes a new instance of the class.
37 | ///
38 | /// The order.
39 | public CategoryOrderAttribute(string category, int order)
40 | {
41 | Category = category;
42 | Order = order;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Metadata/FlatternHierarchyAttribute.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Specifies whether the property hierarchy should be flatterned for visualization.
20 | ///
21 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
22 | [Obsolete("This attribute is deprecated and is no longer supported by PropertyGrid. Please consider using custom type descriptors or ModelView classes in order to gain flattern behavior.", false)]
23 | public sealed class FlatternHierarchyAttribute : Attribute { }
24 | }
25 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Metadata/NumberRangeAttribute.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Specifies a range.
20 | ///
21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
22 | public sealed class NumberRangeAttribute : Attribute
23 | {
24 | ///
25 | /// Gets or sets the minimum.
26 | ///
27 | /// The minimum.
28 | public double Minimum { get; private set; }
29 |
30 | ///
31 | /// Gets or sets the maximum.
32 | ///
33 | /// The maximum.
34 | public double Maximum { get; private set; }
35 |
36 | ///
37 | /// Gets or sets the tick.
38 | ///
39 | /// The tick.
40 | public double Tick { get; private set; }
41 |
42 | ///
43 | /// Gets or sets the precision.
44 | ///
45 | /// The precision.
46 | public double Precision { get; private set; }
47 |
48 | ///
49 | /// Initializes a new instance of the class.
50 | ///
51 | /// The minimum.
52 | /// The maximum.
53 | /// The tick.
54 | public NumberRangeAttribute(double minimum, double maximum, double tick)
55 | : this(minimum, maximum, tick, 0)
56 | {
57 | }
58 |
59 | ///
60 | /// Initializes a new instance of the class.
61 | ///
62 | /// The minimum.
63 | /// The maximum.
64 | /// The tick.
65 | /// The precision.
66 | public NumberRangeAttribute(double minimum, double maximum, double tick, double precision)
67 | {
68 | Minimum = minimum;
69 | Maximum = maximum;
70 | Tick = tick;
71 | Precision = precision;
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Metadata/PropertyOrderAttribute.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Specifies the order of property.
20 | ///
21 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
22 | public sealed class PropertyOrderAttribute : Attribute
23 | {
24 | ///
25 | /// Gets or sets the order.
26 | ///
27 | /// The order.
28 | public int Order { get; private set; }
29 |
30 | ///
31 | /// Initializes a new instance of the class.
32 | ///
33 | /// The order.
34 | public PropertyOrderAttribute(int order)
35 | {
36 | Order = order;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace System.Windows.Controls.WpfPropertyGrid.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyDisplayMode.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Defines modes for property visualization.
20 | ///
21 | public enum PropertyDisplayMode
22 | {
23 | ///
24 | /// Show all properties.
25 | ///
26 | All,
27 | ///
28 | /// Show dependency properties only.
29 | ///
30 | Dependency,
31 | ///
32 | /// Show native CLR properties only.
33 | ///
34 | Native
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/CategoryItemComparer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Collections.Generic;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | /// Default comparer.
22 | ///
23 | public class CategoryItemComparer : IComparer
24 | {
25 | #region IComparer Members
26 |
27 | ///
28 | /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
29 | ///
30 | /// The first object to compare.
31 | /// The second object to compare.
32 | ///
33 | /// Value
34 | /// Condition
35 | /// Less than zero
36 | /// is less than .
37 | /// Zero
38 | /// equals .
39 | /// Greater than zero
40 | /// is greater than .
41 | ///
42 | public int Compare(CategoryItem x, CategoryItem y)
43 | {
44 | if (x == y) return 0;
45 | if (x == null) return -1;
46 | if (y == null) return 1;
47 |
48 | int leftOrder = x.Order;
49 | int rightOrder = y.Order;
50 |
51 | if (leftOrder == rightOrder)
52 | return string.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase);
53 |
54 | return leftOrder.CompareTo(rightOrder);
55 | }
56 |
57 | #endregion
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/Filters/IPropertyFilterTarget.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Describes an object that supports filtering.
20 | ///
21 | public interface IPropertyFilterTarget
22 | {
23 | ///
24 | /// Occurs when filter is applied for the entry.
25 | ///
26 | event EventHandler FilterApplied;
27 |
28 | ///
29 | /// Applies the filter for the entry.
30 | ///
31 | /// The filter.
32 | void ApplyFilter(PropertyFilter filter);
33 |
34 | ///
35 | /// Checks whether the entry matches the filtering predicate.
36 | ///
37 | /// The filtering predicate.
38 | /// true if entry matches filter; otherwise, false.
39 | bool MatchesPredicate(PropertyFilterPredicate predicate);
40 |
41 | ///
42 | /// Gets or sets a value indicating whether the entry matches filter.
43 | ///
44 | /// true if entry matches filter; otherwise, false.
45 | bool MatchesFilter { get; }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/Filters/PropertyFilterAppliedEventArgs.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Contains state information and data related to FilterApplied event.
20 | ///
21 | public sealed class PropertyFilterAppliedEventArgs : EventArgs
22 | {
23 | ///
24 | /// Gets the filter.
25 | ///
26 | /// The filter.
27 | public PropertyFilter Filter { get; private set; }
28 |
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | /// The filter.
33 | public PropertyFilterAppliedEventArgs(PropertyFilter filter)
34 | {
35 | Filter = filter;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/Filters/PropertyFilterPredicate.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Globalization;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | /// Property filter predicate.
22 | ///
23 | public class PropertyFilterPredicate
24 | {
25 | ///
26 | /// Gets or sets the match text.
27 | ///
28 | /// The match text.
29 | public string MatchText { get; private set; }
30 |
31 | ///
32 | /// Initializes a new instance of the class.
33 | ///
34 | /// The match text.
35 | public PropertyFilterPredicate(string matchText)
36 | {
37 | if (matchText == null) throw new ArgumentNullException("matchText");
38 | MatchText = matchText.ToUpper(CultureInfo.CurrentCulture);
39 | }
40 |
41 | ///
42 | /// Matches the specified target.
43 | ///
44 | /// The target.
45 | /// true if target matches predicate; otherwise, false.
46 | public virtual bool Match(string target)
47 | {
48 | return ((target != null) && target.ToUpper(CultureInfo.CurrentCulture).Contains(MatchText));
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/NamedColor.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Windows.Media;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | /// Provides basic information for named colors.
22 | ///
23 | public sealed class NamedColor
24 | {
25 | #region Properties
26 | ///
27 | /// Gets or sets the name.
28 | ///
29 | /// The name.
30 | public String Name { get; private set; }
31 |
32 | ///
33 | /// Gets or sets the color.
34 | ///
35 | /// The color.
36 | public Color Color { get; private set; }
37 |
38 | ///
39 | /// Gets or sets the brush.
40 | ///
41 | /// The brush.
42 | public Brush Brush { get; private set; }
43 | #endregion
44 |
45 | #region ctor
46 | ///
47 | /// Initializes a new instance of the class.
48 | ///
49 | /// The name.
50 | /// The color.
51 | public NamedColor(string name, Color color)
52 | {
53 | if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");
54 |
55 | Name = name;
56 | Color = color;
57 | Brush = (Brush)new SolidColorBrush(color).GetAsFrozen();
58 | }
59 | #endregion
60 |
61 | #region Overrides
62 | ///
63 | /// Returns a that represents the current .
64 | ///
65 | ///
66 | /// A that represents the current .
67 | ///
68 | public override String ToString()
69 | {
70 | return Name;
71 | }
72 | #endregion
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/NamedColorList.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Collections.ObjectModel;
17 | using System.Reflection;
18 | using System.Windows.Media;
19 |
20 | namespace System.Windows.Controls.WpfPropertyGrid
21 | {
22 | ///
23 | /// Provides a list of colors that is possible to bind to UI
24 | ///
25 | // For more details see http://shevaspace.spaces.live.com/blog/cns!FD9A0F1F8DD06954!435.entry
26 | public sealed class NamedColorList: ObservableCollection
27 | {
28 | ///
29 | /// Initializes a new instance of the class.
30 | ///
31 | public NamedColorList()
32 | {
33 | NamedColor nc;
34 | const MethodAttributes inclusiveAttributes = MethodAttributes.Static | MethodAttributes.Public;
35 |
36 | foreach (var pi in typeof(Colors).GetProperties())
37 | {
38 | if (pi.PropertyType != typeof(Color)) continue;
39 |
40 | var mi = pi.GetGetMethod();
41 | if ((mi == null) || ((mi.Attributes & inclusiveAttributes) != inclusiveAttributes)) continue;
42 |
43 | nc = new NamedColor(pi.Name, (Color)pi.GetValue(null, null));
44 | Add(nc);
45 | }
46 |
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/PropertyItemComparer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Collections.Generic;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | /// Default comparer.
22 | ///
23 | public class PropertyItemComparer : IComparer
24 | {
25 | ///
26 | /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
27 | ///
28 | /// The first object to compare.
29 | /// The second object to compare.
30 | ///
31 | /// Value
32 | /// Condition
33 | /// Less than zero
34 | /// is less than .
35 | /// Zero
36 | /// equals .
37 | /// Greater than zero
38 | /// is greater than .
39 | ///
40 | public virtual int Compare(PropertyItem x, PropertyItem y)
41 | {
42 | if (x == y) return 0;
43 | if (x == null) return -1;
44 | if (y == null) return 1;
45 |
46 | int leftOrder = 0;
47 |
48 | var attribute = x.GetAttribute();
49 | if (attribute != null)
50 | leftOrder = attribute.Order;
51 |
52 | int rightOrder = 0;
53 |
54 | attribute = y.GetAttribute();
55 | if (attribute != null)
56 | rightOrder = attribute.Order;
57 |
58 | int num = (leftOrder == rightOrder) ? 0 : leftOrder.CompareTo(rightOrder);
59 | if (num != 0) return num;
60 |
61 | return string.Compare(x.Name, y.Name, true);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditing/ValueExceptionSource.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Specifies the source of value exception
20 | ///
21 | public enum ValueExceptionSource
22 | {
23 | ///
24 | /// Exception occurred during a Get operation
25 | ///
26 | Get,
27 | ///
28 | /// Exception occurred during a Set operation
29 | ///
30 | Set
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyEditingEventArgs.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.ComponentModel;
17 |
18 | namespace System.Windows.Controls.WpfPropertyGrid
19 | {
20 | ///
21 | /// Encapsulates a method that contains an object and PropertyEditingEventArgs event arguments.
22 | ///
23 | public delegate void PropertyEditingEventHandler(object sender, PropertyEditingEventArgs e);
24 |
25 | public class PropertyEditingEventArgs : RoutedEventArgs
26 | {
27 | ///
28 | /// Gets property descriptor.
29 | ///
30 | // TODO: Replace with my wrapper?
31 | public PropertyDescriptor PropertyDescriptor { get; private set; }
32 |
33 | public PropertyEditingEventArgs(RoutedEvent routedEvent, object source, PropertyDescriptor propertyDescriptor)
34 | : base(routedEvent, source)
35 | {
36 | PropertyDescriptor = propertyDescriptor;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyGridUtils.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | using System.Collections.Generic;
17 | using System.Linq;
18 |
19 | namespace System.Windows.Controls.WpfPropertyGrid
20 | {
21 | internal static class PropertyGridUtils
22 | {
23 | public static IEnumerable GetAttributes(object target)
24 | {
25 | if (target == null) throw new ArgumentNullException("target");
26 | return GetAttributes(target.GetType());
27 | }
28 |
29 | public static IEnumerable GetAttributes(Type type)
30 | {
31 | if (type == null) throw new ArgumentNullException("type");
32 |
33 | var attributes =
34 | from T attribute
35 | in type.GetCustomAttributes(typeof(T), true)
36 | select attribute;
37 |
38 | return attributes;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/PropertyValueChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Encapsulates a method that contains an object and PropertyValueChanged event arguments.
20 | ///
21 | public delegate void PropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e);
22 |
23 | ///
24 | /// Contains state information and data associated with property value change events.
25 | ///
26 | public sealed class PropertyValueChangedEventArgs : RoutedEventArgs
27 | {
28 | ///
29 | /// Gets the old value.
30 | ///
31 | /// The old value.
32 | public object OldValue { get; private set; }
33 | ///
34 | /// Gets the new value.
35 | ///
36 | /// The new value.
37 | public object NewValue { get; private set; }
38 | ///
39 | /// Gets the property.
40 | ///
41 | /// The property.
42 | public PropertyItem Property { get; private set; }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | /// The routed event.
48 | /// The property.
49 | /// The old value.
50 | public PropertyValueChangedEventArgs(RoutedEvent routedEvent, PropertyItem property, object oldValue)
51 | : base(routedEvent, property)
52 | {
53 | Property = property;
54 | NewValue = property.PropertyValue;
55 | OldValue = oldValue;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/ResourceLocator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2010, Denys Vuika
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace System.Windows.Controls.WpfPropertyGrid
17 | {
18 | ///
19 | /// Provides a unified approach for resolving resources.
20 | ///
21 | public class ResourceLocator
22 | {
23 | private readonly Application _application;
24 |
25 | ///
26 | /// Initializes a new instance of the class.
27 | ///
28 | public ResourceLocator() : this(Application.Current) { }
29 |
30 | ///
31 | /// Initializes a new instance of the class.
32 | ///
33 | /// The application instance.
34 | public ResourceLocator(Application application)
35 | {
36 | _application = application;
37 | }
38 |
39 | ///
40 | /// Gets the resource.
41 | ///
42 | /// The key.
43 | /// Object from resources.
44 | public virtual object GetResource(object key)
45 | {
46 | return _application.TryFindResource(key);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Themes/DoubleEditor.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
30 |
31 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Themes/Images/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Main/WpfPropertyGrid/Themes/Images/clear.png
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/Themes/Images/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Main/WpfPropertyGrid/Themes/Images/search.png
--------------------------------------------------------------------------------
/Main/WpfPropertyGrid/WpfPropertyGrid.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Main/WpfPropertyGrid/WpfPropertyGrid.snk
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/README
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WPG
2 | WPF PropertyGrid Control
3 |
4 | Please refer to [Wiki](https://github.com/DenisVuyka/WPG/wiki) for more details.
5 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace Samples.BrushCategory
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Samples.BrushCategory")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("Samples.BrushCategory")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Samples.BrushCategory.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.BrushCategory/Window1.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Brush category editor
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
32 |
33 |
34 |
39 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace CategoryEditor
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/BusinessObject.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Controls.WpfPropertyGrid;
5 |
6 | namespace CategoryEditor
7 | {
8 | ///
9 | /// Sample business object
10 | ///
11 | [CategoryOrder("Text", 0)]
12 | [CategoryOrder("Misc", 1)]
13 | public class BusinessObject : INotifyPropertyChanged
14 | {
15 | #region Fields
16 |
17 | private string _name;
18 | private FontFamily _fontFamily = new FontFamily("Arial");
19 | private double _fontSize = 8;
20 | private FontWeight _fontWeight = FontWeights.Bold;
21 | private FontStyle _fontStyle = FontStyles.Italic;
22 |
23 | #endregion
24 |
25 |
26 |
27 | public string Name
28 | {
29 | get { return _name; }
30 | set
31 | {
32 | if (_name == value) return;
33 | _name = value;
34 | OnPropertyChanged("Name");
35 | }
36 | }
37 |
38 | #region Text-related properties
39 |
40 | [Category("Text")]
41 | public FontFamily FontFamily
42 | {
43 | get { return _fontFamily; }
44 | set
45 | {
46 | if (_fontFamily == value) return;
47 | _fontFamily = value;
48 | OnPropertyChanged("FontFamily");
49 | }
50 | }
51 |
52 | [Category("Text")]
53 | public double FontSize
54 | {
55 | get { return _fontSize; }
56 | set
57 | {
58 | if (_fontSize == value) return;
59 | _fontSize = value;
60 | OnPropertyChanged("FontSize");
61 | }
62 | }
63 |
64 | [Category("Text")]
65 | public FontWeight FontWeight
66 | {
67 | get { return _fontWeight; }
68 | set
69 | {
70 | if (_fontWeight == value) return;
71 | _fontWeight = value;
72 | OnPropertyChanged("FontWeight");
73 | }
74 | }
75 |
76 | [Category("Text")]
77 | public FontStyle FontStyle
78 | {
79 | get { return _fontStyle; }
80 | set
81 | {
82 | if (_fontStyle == value) return;
83 | _fontStyle = value;
84 | OnPropertyChanged("FontStyle");
85 | }
86 | }
87 |
88 | #endregion
89 |
90 | #region INotifyPropertyChanged Members
91 |
92 | public event PropertyChangedEventHandler PropertyChanged;
93 |
94 | protected void OnPropertyChanged(string propertyName)
95 | {
96 | var handler = PropertyChanged;
97 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
98 | }
99 |
100 | #endregion
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/EditorKeys.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace CategoryEditor
4 | {
5 | public static class EditorKeys
6 | {
7 | private static readonly ComponentResourceKey textCategoryEditorKey =
8 | new ComponentResourceKey(typeof(EditorKeys), "TextCategoryEditor");
9 |
10 | public static ComponentResourceKey TextCategoryEditorKey
11 | {
12 | get { return textCategoryEditorKey; }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/FontList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.Windows.Media;
3 |
4 | namespace CategoryEditor
5 | {
6 | public class FontList : ObservableCollection
7 | {
8 | public FontList()
9 | {
10 | foreach (var ff in Fonts.SystemFontFamilies)
11 | {
12 | Add(ff);
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/FontSizeList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace CategoryEditor
4 | {
5 | public class FontSizeList : ObservableCollection
6 | {
7 | public FontSizeList()
8 | {
9 | Add(8);
10 | Add(9);
11 | Add(10);
12 | Add(11);
13 | Add(12);
14 | Add(14);
15 | Add(16);
16 | Add(18);
17 | Add(20);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/FontStyleConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace CategoryEditor
7 | {
8 | public class FontStyleConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | var fs = (FontStyle)value;
13 | return fs == FontStyles.Italic;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17 | {
18 | if (value != null)
19 | {
20 | bool isSet = (bool)value;
21 |
22 | if (isSet)
23 | {
24 | return FontStyles.Italic;
25 | }
26 | }
27 |
28 | return FontStyles.Normal;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/FontWeightConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace CategoryEditor
7 | {
8 | public class FontWeightConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | var fw = (FontWeight)value;
13 | return fw == FontWeights.Bold;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17 | {
18 | if (value != null)
19 | {
20 | bool isSet = (bool)value;
21 |
22 | if (isSet)
23 | {
24 | return FontWeights.Bold;
25 | }
26 | }
27 |
28 | return FontWeights.Normal;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("CategoryEditor")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("CategoryEditor")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CategoryEditor.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/Window1.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Samples/WPG.CategoryEditor/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace CategoryEditor
4 | {
5 | public partial class Window1 : Window
6 | {
7 | public Window1()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace ComplexProperty
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Female.cs:
--------------------------------------------------------------------------------
1 | namespace ComplexProperty
2 | {
3 | public class Female : Human
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Human.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace ComplexProperty
4 | {
5 | public class Human : INotifyPropertyChanged
6 | {
7 | private string _name = "John";
8 | private string _surname = "Doe";
9 |
10 | [NotifyParentProperty(true)]
11 | public string Name
12 | {
13 | get { return _name; }
14 | set
15 | {
16 | if (_name == value) return;
17 | _name = value;
18 | OnPropertyChanged("Name");
19 | }
20 | }
21 |
22 | public string Surname
23 | {
24 | get { return _surname; }
25 | set
26 | {
27 | if (_surname == value) return;
28 | _surname = value;
29 | OnPropertyChanged("Surname");
30 | }
31 | }
32 |
33 | #region INotifyPropertyChanged Members
34 |
35 | public event PropertyChangedEventHandler PropertyChanged;
36 |
37 | protected void OnPropertyChanged(string propertyName)
38 | {
39 | var handler = PropertyChanged;
40 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
41 | }
42 |
43 | #endregion
44 |
45 | public override string ToString()
46 | {
47 | return (string.IsNullOrEmpty(_name))
48 | ? "(unknown)"
49 | : _name;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Male.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | namespace ComplexProperty
3 | {
4 | public class Male : Human
5 | {
6 | private Female _wife = new Female { Name = "Joan", Surname = "Doe" };
7 |
8 | [TypeConverter(typeof(ExpandableObjectConverter))]
9 | public Female Wife
10 | {
11 | get { return _wife; }
12 | set
13 | {
14 | if (_wife == value) return;
15 | _wife = value;
16 | OnPropertyChanged("Wife");
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("ComplexProperty")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("ComplexProperty")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ComplexProperty.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Window1.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Samples/WPG.ComplexProperty/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace ComplexProperty
16 | {
17 | ///
18 | /// Interaction logic for Window1.xaml
19 | ///
20 | public partial class Window1 : Window
21 | {
22 | public Window1()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace Sample4.CustomTypeEditors
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Converters/DefaultPercentConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Data;
3 |
4 | namespace Sample4.CustomTypeEditors
5 | {
6 | public class DefaultPercentConverter : IValueConverter
7 | {
8 | #region IValueConverter Member
9 |
10 |
11 |
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 |
15 | if (value != null)
16 | {
17 |
18 | string val = value.ToString();
19 |
20 | val = val.Replace(".", ",");
21 |
22 | decimal dec = Decimal.Parse(val);
23 |
24 |
25 |
26 | //Komma verschieben
27 |
28 | int shiftFactor = (int)Math.Pow(10, 2);
29 |
30 | decimal tmp = dec * shiftFactor;
31 |
32 |
33 |
34 | //Runden: 0.5 addieren/subtrahieren und dann Nachkommastellen abschneiden
35 |
36 | decimal diff = (tmp >= 0 ? 0.5m : -0.5m);
37 |
38 | tmp = (long)(tmp + diff);
39 |
40 |
41 |
42 | //Komma wieder verschieben
43 |
44 | dec = (tmp / shiftFactor);
45 |
46 | val = dec.ToString();
47 |
48 |
49 |
50 | int index = val.IndexOf(",");
51 |
52 | if (index == -1)
53 |
54 | val += ",00";
55 |
56 |
57 |
58 | val += "%";
59 |
60 | return val;
61 |
62 | }
63 |
64 | return "0,00%";
65 |
66 | }
67 |
68 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
69 | {
70 | if (value != null)
71 | {
72 | string val = value.ToString();
73 | val = val.Replace("%", "");
74 | //decimal dec = Decimal.Parse(val);
75 | //return dec;
76 | }
77 | return value;
78 | }
79 |
80 | #endregion
81 |
82 |
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Converters/EmptyValueConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Sample4.CustomTypeEditors
6 | {
7 | ///
8 | /// Specialized converter for keeping bindings alive.
9 | ///
10 | public class EmptyValueConverter : IValueConverter
11 | {
12 | #region IValueConverter Members
13 |
14 | ///
15 | /// Converts a value.
16 | ///
17 | /// The value produced by the binding source.
18 | /// The type of the binding target property.
19 | /// The converter parameter to use.
20 | /// The culture to use in the converter.
21 | ///
22 | /// A converted value. If the method returns null, the valid null value is used.
23 | ///
24 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
25 | {
26 | return value;
27 | }
28 |
29 | ///
30 | /// Converts a value.
31 | ///
32 | /// The value that is produced by the binding target.
33 | /// The type to convert to.
34 | /// The converter parameter to use.
35 | /// The culture to use in the converter.
36 | ///
37 | /// A converted value. If the method returns null, the valid null value is used.
38 | ///
39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
40 | {
41 | return value;
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/CustomCategories/FontList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.Windows.Media;
3 |
4 | namespace Sample4.CustomTypeEditors
5 | {
6 | public class FontList : ObservableCollection
7 | {
8 | public FontList()
9 | {
10 | foreach (var ff in Fonts.SystemFontFamilies)
11 | {
12 | Add(ff);
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/CustomCategories/FontSizeList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace Sample4.CustomTypeEditors
4 | {
5 | public class FontSizeList : ObservableCollection
6 | {
7 | public FontSizeList()
8 | {
9 | Add(8);
10 | Add(9);
11 | Add(10);
12 | Add(11);
13 | Add(12);
14 | Add(14);
15 | Add(16);
16 | Add(18);
17 | Add(20);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/CustomCategories/FontStyleConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Sample4.CustomTypeEditors
7 | {
8 | public class FontStyleConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | FontStyle fs = (FontStyle)value;
13 | return fs == FontStyles.Italic;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17 | {
18 | if (value != null)
19 | {
20 | bool isSet = (bool)value;
21 |
22 | if (isSet)
23 | {
24 | return FontStyles.Italic;
25 | }
26 | }
27 |
28 | return FontStyles.Normal;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/CustomCategories/FontWeightConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Sample4.CustomTypeEditors
7 | {
8 | public class FontWeightConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | var fs = (FontWeight)value;
13 | return fs == FontWeights.Bold;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17 | {
18 | if (value != null)
19 | {
20 | bool isSet = (bool)value;
21 |
22 | if (isSet)
23 | {
24 | return FontWeights.Bold;
25 | }
26 | }
27 |
28 | return FontWeights.Normal;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/LocalResources.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace Sample4.CustomTypeEditors
5 | {
6 | public static class LocalResources
7 | {
8 | private static readonly Type _ThisType = typeof(LocalResources);
9 | private static readonly ComponentResourceKey _FileBrowserEditorKey = new ComponentResourceKey(_ThisType, "FileBrowserEditorTemplate");
10 | private static readonly ComponentResourceKey _PercentEditorKey = new ComponentResourceKey(_ThisType, "PercentEditorTemplate");
11 | private static readonly ComponentResourceKey _XmlLanguageEditorKey = new ComponentResourceKey(_ThisType, "XmlLanguageEditorTemplate");
12 |
13 | public static ComponentResourceKey FileBrowserEditorKey
14 | {
15 | get { return _FileBrowserEditorKey; }
16 | }
17 |
18 | public static ComponentResourceKey PercentEditorKey
19 | {
20 | get { return _PercentEditorKey; }
21 | }
22 |
23 | public static ComponentResourceKey XmlLanguageEditorKey
24 | {
25 | get { return _XmlLanguageEditorKey; }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/MyEditors/FileBrowserDialogPropertyValueEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.Win32;
4 |
5 | namespace Sample4.CustomTypeEditors
6 | {
7 | // TODO: Refactoring needed!
8 | public class FileBrowserDialogPropertyValueEditor : Editor
9 | {
10 | public FileBrowserDialogPropertyValueEditor()
11 | {
12 | InlineTemplate = LocalResources.FileBrowserEditorKey;
13 | }
14 |
15 | public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource)
16 | {
17 | if (propertyValue == null) return;
18 | if (propertyValue.ParentProperty.IsReadOnly) return;
19 |
20 | var ofd = new OpenFileDialog();
21 | ofd.Multiselect = false;
22 |
23 | var property = propertyValue.ParentProperty;
24 | if (property != null)
25 | {
26 | var optionsAttribute = (OpenFileDialogOptionsAttribute)property.Attributes[typeof(OpenFileDialogOptionsAttribute)];
27 | if (optionsAttribute != null)
28 | optionsAttribute.ConfigureDialog(ofd);
29 | }
30 |
31 | if (ofd.ShowDialog() == true)
32 | propertyValue.StringValue = ofd.FileName;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Sample4.CustomTypeEditors")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Sample4.CustomTypeEditors")]
15 | [assembly: AssemblyCopyright("Copyright © 2008")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Sample4.CustomTypeEditors.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows;
4 | using System.Windows.Controls.WpfPropertyGrid;
5 |
6 | namespace Sample4.CustomTypeEditors
7 | {
8 | ///
9 | /// Interaction logic for Window1.xaml
10 | ///
11 | public partial class Window1
12 | {
13 | readonly BusinessObject bo;
14 |
15 | public Window1()
16 | {
17 | InitializeComponent();
18 |
19 | bo = new BusinessObject();
20 |
21 | propertyGrid.SelectedObjectsChanged += propertyGrid_SelectedObjectsChanged;
22 | propertyGrid.SelectedObject = bo;
23 | propertyGrid.PropertyValueChanged += propertyGrid_PropertyValueChanged;
24 | }
25 |
26 | void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
27 | {
28 |
29 | }
30 |
31 | void propertyGrid_SelectedObjectsChanged(object sender, EventArgs e)
32 | {
33 |
34 | }
35 |
36 | private void btnTest_Click(object sender, RoutedEventArgs e)
37 | {
38 | PropertyItem prop = propertyGrid.Properties["Name"];
39 | if (prop != null)
40 | {
41 | //prop.IsReadOnly = !prop.IsReadOnly;
42 | prop.IsBrowsable = !prop.IsBrowsable;
43 | }
44 | }
45 |
46 | static Random random = new Random();
47 |
48 | private void btnSwitchObjects_Click(object sender, RoutedEventArgs e)
49 | {
50 | propertyGrid.SelectedObject = new BusinessObject
51 | {
52 | Name = Path.GetRandomFileName(),
53 | Password = Path.GetRandomFileName(),
54 | RegisteredDate = DateTime.Now,
55 | Integer1 = random.Next(1000),
56 | Integer2 = random.Next(1000),
57 | Integer3 = random.Next(1000),
58 | Integer4 = random.Next(1000),
59 | Attachment = Path.GetRandomFileName()
60 | };
61 |
62 | //propertyGrid.Properties["Name"].SetPropertySouce(new BusinessObject { Name = Path.GetRandomFileName() });
63 | }
64 |
65 | private void btnSelectMultiple_Click(object sender, RoutedEventArgs e)
66 | {
67 | object[] objects = new object[]
68 | {
69 | new BusinessObject { Name = "Denis Vuyka", Integer1 = 10 },
70 | new BusinessObject { Name = "Marilyn Manson", Integer1 = 10 },
71 | new BusinessObject { Name = "Charles Darvin", Integer1 = 10 }
72 | };
73 |
74 | this.propertyGrid.SelectedObjects = objects;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Samples/WPG.CustomTypeEditors/XmlLanguageList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.Globalization;
3 | using System.Windows.Markup;
4 |
5 | namespace Sample4.CustomTypeEditors
6 | {
7 | public sealed class XmlLanguageList : ObservableCollection
8 | {
9 | public XmlLanguageList()
10 | {
11 | foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
12 | {
13 | if (string.IsNullOrEmpty(ci.IetfLanguageTag)) continue;
14 | Add(XmlLanguage.GetLanguage(ci.IetfLanguageTag));
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/App.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace DialogEditor
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/BusinessObject.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using System.ComponentModel;
3 |
4 | namespace DialogEditor
5 | {
6 | public class BusinessObject : INotifyPropertyChanged
7 | {
8 | private string name;
9 | private string photo;
10 | private string description;
11 | [PropertyOrder(0)]
12 | public string Name
13 | {
14 | get { return name; }
15 | set
16 | {
17 | if (name == value) return;
18 | name = value;
19 | OnPropertyChanged("Name");
20 | }
21 | }
22 | [PropertyOrder(1)]
23 | public string Description
24 | {
25 | get { return description; }
26 | //set
27 | //{
28 | // if (description == value) return;
29 | // description = value;
30 | // OnPropertyChanged("Description");
31 | //}
32 | }
33 | [PropertyOrder(2)]
34 | public string Descriptionx
35 | {
36 | get { return description; }
37 | set
38 | {
39 | if (description == value) return;
40 | description = value;
41 | OnPropertyChanged("Description");
42 | }
43 | }
44 |
45 | [PropertyEditor(typeof(FilePathPicker))]
46 | [PropertyOrder(3)]
47 | public string Photo
48 | {
49 | get { return photo; }
50 | set
51 | {
52 | if (photo == value) return;
53 | photo = value;
54 | OnPropertyChanged("Photo");
55 | }
56 | }
57 |
58 | #region INotifyPropertyChanged Members
59 |
60 | public event PropertyChangedEventHandler PropertyChanged;
61 |
62 | protected void OnPropertyChanged(string propertyName)
63 | {
64 | var handler = PropertyChanged;
65 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
66 | }
67 |
68 | #endregion
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/EditorKeys.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace DialogEditor
4 | {
5 | public static class EditorKeys
6 | {
7 | private static ComponentResourceKey _FilePathPickerEditorKey =
8 | new ComponentResourceKey(typeof(EditorKeys), "FilePathPickerEditor");
9 |
10 | public static ComponentResourceKey FilePathPickerEditorKey
11 | {
12 | get { return _FilePathPickerEditorKey; }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/FilePathPicker.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.Win32;
4 |
5 | namespace DialogEditor
6 | {
7 | public class FilePathPicker : PropertyEditor
8 | {
9 | public FilePathPicker()
10 | {
11 | this.InlineTemplate = EditorKeys.FilePathPickerEditorKey;
12 | }
13 |
14 | public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource)
15 | {
16 | if (propertyValue == null) return;
17 | if (propertyValue.ParentProperty.IsReadOnly) return;
18 |
19 | OpenFileDialog ofd = new OpenFileDialog
20 | {
21 | Filter = "Image Files (*.jpg, *.png, *.bmp)|*.jpg;*.png;*.bmp",
22 | Multiselect = false
23 | };
24 |
25 | if (ofd.ShowDialog() == true)
26 | {
27 | propertyValue.StringValue = ofd.FileName;
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("DialogEditor")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("DialogEditor")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DialogEditor.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/Window1.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Samples/WPG.DialogEditor/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace DialogEditor
4 | {
5 | public partial class Window1 : Window
6 | {
7 | public Window1()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace WPG.ExtendedEditor
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace WPG.ExtendedEditor
16 | {
17 | ///
18 | /// Interaction logic for MainWindow.xaml
19 | ///
20 | public partial class MainWindow : Window
21 | {
22 | public MainWindow()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("WPG.ExtendedEditor")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("WPG.ExtendedEditor")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.372
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WPG.ExtendedEditor.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.ExtendedEditor/ViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace WPG.ExtendedEditor
4 | {
5 | public class ViewModel : INotifyPropertyChanged
6 | {
7 | private string _firstName;
8 | private string _lastName;
9 | private string _details;
10 |
11 | public string FirstName
12 | {
13 | get { return _firstName; }
14 | set
15 | {
16 | if (_firstName == value) return;
17 | _firstName = value;
18 | OnPropertyChanged("FirstName");
19 | }
20 | }
21 |
22 | public string LastName
23 | {
24 | get { return _lastName; }
25 | set
26 | {
27 | if (_lastName == value) return;
28 | _lastName = value;
29 | OnPropertyChanged("LastName");
30 | }
31 | }
32 |
33 | public string Details
34 | {
35 | get { return _details; }
36 | set
37 | {
38 | if (_details == value) return;
39 | _details = value;
40 | OnPropertyChanged("Details");
41 | }
42 | }
43 |
44 | public event PropertyChangedEventHandler PropertyChanged;
45 | private void OnPropertyChanged(string propertyName)
46 | {
47 | var handler = PropertyChanged;
48 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace Sample6.Proxies
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Sample6.Proxies")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Sample6.Proxies")]
15 | [assembly: AssemblyCopyright("Copyright © 2009")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("2010.5.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Sample6.Proxies.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/Window1.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | This sample demonstrates a way providing a Proxy for a TextBox
17 |
18 |
19 |
20 |
21 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Samples/WPG.Proxies/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Sample6.Proxies
4 | {
5 | ///
6 | /// Interaction logic for Window1.xaml
7 | ///
8 | public partial class Window1 : Window
9 | {
10 | public Window1()
11 | {
12 | InitializeComponent();
13 |
14 | this.propertyGrid.SelectedObject = new TextBoxProxy(TargetToProxy);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/BusinessObject.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace WindowsFormsIntegration
4 | {
5 | public class BusinessObject : INotifyPropertyChanged
6 | {
7 | private string _Name = "Noname";
8 | [Category("Personal Information")]
9 | public string Name
10 | {
11 | get { return _Name; }
12 | set
13 | {
14 | if (_Name == value) return;
15 | _Name = value;
16 | OnPropertyChanged("Name");
17 | }
18 | }
19 |
20 | private bool _IsEnabled = true;
21 | [Category("Display")]
22 | public bool IsEnabled
23 | {
24 | get { return _IsEnabled; }
25 | set
26 | {
27 | if (_IsEnabled = value) return;
28 | _IsEnabled = value;
29 | OnPropertyChanged("IsEnabled");
30 | }
31 | }
32 |
33 | #region INotifyPropertyChanged Members
34 |
35 | public event PropertyChangedEventHandler PropertyChanged;
36 |
37 | protected virtual void OnPropertyChanged(string propertyName)
38 | {
39 | var handler = PropertyChanged;
40 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace WindowsFormsIntegration
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // Form1
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.ClientSize = new System.Drawing.Size(395, 490);
38 | this.Name = "Form1";
39 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
40 | this.Text = "Windows Forms Integration Sample";
41 | this.ResumeLayout(false);
42 |
43 | }
44 |
45 | #endregion
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Form1.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace WindowsFormsIntegration
4 | {
5 | public partial class Form1 : Form
6 | {
7 | public Form1()
8 | {
9 | InitializeComponent();
10 |
11 | var host = new System.Windows.Forms.Integration.ElementHost { Dock = DockStyle.Fill };
12 |
13 | var wpg = new System.Windows.Controls.WpfPropertyGrid.PropertyGrid
14 | {
15 | Layout = new System.Windows.Controls.WpfPropertyGrid.Design.CategorizedLayout()
16 | };
17 | host.Child = wpg;
18 |
19 | wpg.SelectedObject = new BusinessObject();
20 |
21 | this.Controls.Add(host);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace WindowsFormsIntegration
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | new System.Windows.Application();
15 |
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new Form1());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("WindowsFormsIntegration")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("WindowsFormsIntegration")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("35648107-f9af-4bde-a2cb-1e40f726026c")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("2010.5.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WindowsFormsIntegration.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/WPG.WindowsFormsIntegration/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/CategoryEditorTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls.WpfPropertyGrid;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests
7 | {
8 | [TestClass]
9 | public class CategoryEditorTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(ArgumentNullException))]
13 | public void ShouldFailForNullType()
14 | {
15 | new CategoryEditor(null, "category", new DataTemplate());
16 | }
17 |
18 | [TestMethod]
19 | [ExpectedException(typeof(ArgumentNullException))]
20 | public void ShouldFailForEmptyCategoryName()
21 | {
22 | new CategoryEditor(typeof(string), null, new DataTemplate());
23 | }
24 |
25 | [TestMethod]
26 | public void ShouldInitilizePropertiesFromConstructor()
27 | {
28 | DataTemplate template = new DataTemplate();
29 | CategoryEditor editor = new CategoryEditor(typeof(string), "category", template);
30 |
31 | Assert.AreEqual(typeof(string), editor.DeclaringType);
32 | Assert.AreEqual("category", editor.CategoryName);
33 | Assert.AreEqual(template, editor.InlineTemplate);
34 | }
35 |
36 | [TestMethod]
37 | [ExpectedException(typeof(ArgumentException))]
38 | public void ShouldFailInitializingInvalidTemplate()
39 | {
40 | new CategoryEditor(typeof(string), "category", "invalid_value");
41 | }
42 |
43 | [TestMethod]
44 | public void ShouldAllowSettingCategoryName()
45 | {
46 | CategoryEditor editor = new CategoryEditor();
47 | editor.CategoryName = "category";
48 |
49 | Assert.AreEqual("category", editor.CategoryName);
50 | }
51 |
52 | [TestMethod]
53 | public void ShouldAllowSettingDeclaringType()
54 | {
55 | CategoryEditor editor = new CategoryEditor();
56 | editor.DeclaringType = typeof(string);
57 |
58 | Assert.AreEqual(typeof(string), editor.DeclaringType);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/EnumValueConverterTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Controls.WpfPropertyGrid;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Converters
7 | {
8 | [TestClass]
9 | public class EnumValueConverterTest
10 | {
11 | private enum EnumTestCase
12 | {
13 | One,
14 | [System.ComponentModel.Description("description")]
15 | Two,
16 | [System.ComponentModel.Description()]
17 | Three,
18 | }
19 |
20 | [TestMethod]
21 | public void ShouldReturnNullValueString()
22 | {
23 | object converted = new EnumValueConverter().Convert(null, null, null, null);
24 |
25 | Assert.IsInstanceOfType(converted, typeof(string));
26 | Assert.AreEqual(EnumValueConverter.NullValueString, (string)converted);
27 | }
28 |
29 | [TestMethod]
30 | public void ShoudConvertEnumToString()
31 | {
32 | object converted = new EnumValueConverter().Convert(EnumTestCase.One, null, null, null);
33 |
34 | Assert.IsInstanceOfType(converted, typeof(string));
35 | Assert.AreEqual("One", (string)converted);
36 | }
37 |
38 | [TestMethod]
39 | [ExpectedException(typeof(NotSupportedException))]
40 | public void ShouldFailPerformingConversionBack()
41 | {
42 | new EnumValueConverter().ConvertBack(null, null, null, CultureInfo.InvariantCulture);
43 | }
44 |
45 | [TestMethod]
46 | public void ShouldTakeDescriptionAttributeDuringConversion()
47 | {
48 | object converted = new EnumValueConverter().Convert(EnumTestCase.Two, null, null, null);
49 |
50 | Assert.IsInstanceOfType(converted, typeof(string));
51 | Assert.AreEqual("description", (string)converted);
52 | }
53 |
54 | [TestMethod]
55 | public void ShouldConvertToStringForEmptyDescriptionAttribute()
56 | {
57 | object converted = new EnumValueConverter().Convert(EnumTestCase.Three, null, null, null);
58 |
59 | Assert.IsInstanceOfType(converted, typeof(string));
60 | Assert.AreEqual("Three", (string)converted);
61 | }
62 |
63 | [TestMethod]
64 | public void ShouldConvertNonEnumValueToString()
65 | {
66 | object converted = new EnumValueConverter().Convert(1234, null, null, null);
67 |
68 | Assert.IsInstanceOfType(converted, typeof(string));
69 | Assert.AreEqual("1234", (string)converted);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/ExpanderHeaderWidthConverterTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Converters
5 | {
6 | [TestClass]
7 | public class ExpanderHeaderWidthConverterTest
8 | {
9 | [TestMethod]
10 | public void ShouldReturnValueWithDefaultOffset()
11 | {
12 | object converted = new ExpanderHeaderWidthConverter().Convert(100.0, null, null, null);
13 |
14 | Assert.IsInstanceOfType(converted, typeof(double));
15 | Assert.AreEqual(100 + ExpanderHeaderWidthConverter.DefaultOffset, (double)converted);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldReturnValueWithCustomOffset()
20 | {
21 | object converted = new ExpanderHeaderWidthConverter().Convert(100.0, null, 20.0, null);
22 |
23 | Assert.IsInstanceOfType(converted, typeof(double));
24 | Assert.AreEqual(120.0, (double)converted);
25 | }
26 |
27 | [TestMethod]
28 | public void ShouldTakeDefaultOffsetForWrongParameter()
29 | {
30 | object converted = new ExpanderHeaderWidthConverter().Convert(100.0, null, "wrong", null);
31 |
32 | Assert.IsInstanceOfType(converted, typeof(double));
33 | Assert.AreEqual(100 + ExpanderHeaderWidthConverter.DefaultOffset, (double)converted);
34 | }
35 |
36 | [TestMethod]
37 | public void ShouldConvertBackWithDefaultOffset()
38 | {
39 | object converted = new ExpanderHeaderWidthConverter().ConvertBack(100.0, null, null, null);
40 |
41 | Assert.IsInstanceOfType(converted, typeof(double));
42 | Assert.AreEqual(100 - ExpanderHeaderWidthConverter.DefaultOffset, (double)converted);
43 | }
44 |
45 | [TestMethod]
46 | public void ShouldConvertBackWithCustomOffset()
47 | {
48 | object converted = new ExpanderHeaderWidthConverter().ConvertBack(100.0, null, 50, null);
49 |
50 | Assert.IsInstanceOfType(converted, typeof(double));
51 | Assert.AreEqual(50, (double)converted);
52 | }
53 |
54 | [TestMethod]
55 | public void ShouldConvertBackWithDefaultOffsetForWrongParameter()
56 | {
57 | object converted = new ExpanderHeaderWidthConverter().ConvertBack(100.0, null, "wrong", null);
58 |
59 | Assert.IsInstanceOfType(converted, typeof(double));
60 | Assert.AreEqual(100 - ExpanderHeaderWidthConverter.DefaultOffset, (double)converted);
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/FontStretchConverterDecoratorTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using System.Windows;
4 | using System.Globalization;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Converters
7 | {
8 | [TestClass]
9 | public class FontStretchConverterDecoratorTest
10 | {
11 | [TestMethod]
12 | public void ShouldProvideStandardValuesSupported()
13 | {
14 | FontStretchConverterDecorator decorator = new FontStretchConverterDecorator();
15 | Assert.IsTrue(decorator.GetStandardValuesSupported());
16 | Assert.AreEqual(9, decorator.GetStandardValues().Count);
17 | }
18 |
19 | [TestMethod]
20 | public void ShouldRedirectConversionCalls()
21 | {
22 | FontStretchConverter original = new FontStretchConverter();
23 | FontStretchConverterDecorator decorated = new FontStretchConverterDecorator();
24 |
25 | Assert.AreEqual(original.CanConvertFrom(null, typeof(string)), decorated.CanConvertFrom(null, typeof(string)));
26 | Assert.AreEqual(original.CanConvertTo(null, typeof(int)), decorated.CanConvertTo(null, typeof(int)));
27 | Assert.AreEqual(original.ConvertFrom(null, CultureInfo.InvariantCulture, "Condensed"), decorated.ConvertFrom(null, CultureInfo.InvariantCulture, "Condensed"));
28 | Assert.AreEqual(original.ConvertTo(null, CultureInfo.InvariantCulture, FontStretches.Condensed, typeof(string)), decorated.ConvertTo(null, CultureInfo.InvariantCulture, FontStretches.Condensed, typeof(string)));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/FontStyleConverterDecoratorTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Converters
5 | {
6 | [TestClass]
7 | public class FontStyleConverterDecoratorTest
8 | {
9 | [TestMethod]
10 | public void ShouldProvideStandardValuesSupported()
11 | {
12 | FontStyleConverterDecorator decorator = new FontStyleConverterDecorator();
13 | Assert.IsTrue(decorator.GetStandardValuesSupported());
14 | Assert.AreEqual(3, decorator.GetStandardValues().Count);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/FontWeightConverterDecoratorTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Converters
5 | {
6 | [TestClass]
7 | public class FontWeightConverterDecoratorTest
8 | {
9 | [TestMethod]
10 | public void ShouldProvideStandardValuesSupported()
11 | {
12 | FontWeightConverterDecorator decorator = new FontWeightConverterDecorator();
13 | Assert.IsTrue(decorator.GetStandardValuesSupported());
14 | Assert.AreEqual(10, decorator.GetStandardValues().Count);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/MultiBooleanToVisibilityConverterTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 | using System.Windows;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Converters
7 | {
8 | [TestClass]
9 | public class MultiBooleanToVisibilityConverterTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(NotSupportedException))]
13 | public void DoesNotSupportBackwardConversion()
14 | {
15 | new MultiBooleanToVisibilityConverter().ConvertBack(null, null, null, null);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldConvertMultipleValues()
20 | {
21 | Assert.AreEqual(Visibility.Visible, new MultiBooleanToVisibilityConverter().Convert(new object[] { true, true, true }, null, null, null));
22 | Assert.AreEqual(Visibility.Collapsed, new MultiBooleanToVisibilityConverter().Convert(new object[] { false, false, false}, null, null, null));
23 | Assert.AreEqual(Visibility.Collapsed, new MultiBooleanToVisibilityConverter().Convert(new object[] { true, false }, null, null, null));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Converters/NullValueConverterTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Converters
5 | {
6 | [TestClass]
7 | public class NullValueConverterTest
8 | {
9 | [TestMethod]
10 | public void ShouldReturnNullStringForNullValue()
11 | {
12 | object converted = new NullValueConverter().Convert(null, null, null, null);
13 |
14 | Assert.IsInstanceOfType(converted, typeof(string));
15 | Assert.AreEqual(NullValueConverter.NullString, (string)converted);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldConvertProvidedValue()
20 | {
21 | object converted = new NullValueConverter().Convert("test", null, null, null);
22 |
23 | Assert.IsInstanceOfType(converted, typeof(string));
24 | Assert.AreEqual("test", (string)converted);
25 | }
26 |
27 | [TestMethod]
28 | public void ShouldConvertBackNull()
29 | {
30 | object converted = new NullValueConverter().ConvertBack(null, null, null, null);
31 |
32 | Assert.IsNull(converted);
33 | }
34 |
35 | [TestMethod]
36 | public void ShouldConvertBackEmptyString()
37 | {
38 | object converted = new NullValueConverter().ConvertBack(string.Empty, null, null, null);
39 |
40 | Assert.IsNull(converted);
41 | }
42 |
43 | [TestMethod]
44 | public void ShouldConvertBackNullString()
45 | {
46 | object converted = new NullValueConverter().ConvertBack(NullValueConverter.NullString, null, null, null);
47 | Assert.IsNull(converted);
48 | }
49 |
50 | [TestMethod]
51 | public void ShouldConvertBackProvidedValue()
52 | {
53 | object converted = new NullValueConverter().ConvertBack("test", null, null, null);
54 |
55 | Assert.IsInstanceOfType(converted, typeof(string));
56 | Assert.AreEqual("test", (string)converted);
57 | }
58 |
59 | [TestMethod]
60 | public void ShouldConvertNullToParameterValue()
61 | {
62 | object converted = new NullValueConverter().Convert(null, null, "", null);
63 |
64 | Assert.IsInstanceOfType(converted, typeof(string));
65 | Assert.AreEqual("", converted);
66 | }
67 |
68 | [TestMethod]
69 | public void ShouldConvertBackNullFromParameter()
70 | {
71 | Assert.IsNull(new NullValueConverter().ConvertBack("", null, "", null));
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/AlphabeticalLayoutTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests.Layout
6 | {
7 | [TestClass]
8 | public class AlphabeticalLayoutTest
9 | {
10 | private class AlphabeticalLayoutMock : AlphabeticalLayout
11 | {
12 | public object GetDefaultStyleKey()
13 | {
14 | return this.DefaultStyleKey;
15 | }
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldOverrideDefaultStyleKey()
20 | {
21 | Assert.AreEqual((Type)new AlphabeticalLayoutMock().GetDefaultStyleKey(), typeof(AlphabeticalLayout));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/CategorizedLayoutTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests.Layout
6 | {
7 | [TestClass]
8 | public class CategorizedLayoutTest
9 | {
10 | private class CategorizedLayoutMock : CategorizedLayout
11 | {
12 | public object GetDefaultStyleKey()
13 | {
14 | return this.DefaultStyleKey;
15 | }
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldOverrideDefaultStyleKey()
20 | {
21 | Assert.AreEqual((Type)new CategorizedLayoutMock().GetDefaultStyleKey(), typeof(CategorizedLayout));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/CategoryContainerTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Design
5 | {
6 | [TestClass]
7 | public class CategoryContainerTest
8 | {
9 | private class CategoryContainerTestCase : CategoryContainer
10 | {
11 | public object GetDefaultStyleKeyValue()
12 | {
13 | return DefaultStyleKey;
14 | }
15 | }
16 |
17 | [TestMethod]
18 | public void ShouldOverrideDefaultStyle()
19 | {
20 | CategoryContainerTestCase container = new CategoryContainerTestCase();
21 | Assert.AreEqual(typeof(CategoryContainer), container.GetDefaultStyleKeyValue());
22 | }
23 |
24 | [TestMethod]
25 | public void ShouldAssignItselfAsParentContainer()
26 | {
27 | CategoryContainer container = new CategoryContainer();
28 | Assert.AreEqual(container, CategoryContainer.GetParentContainer(container));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/CategoryEditorContentPresenterTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using System.Windows.Data;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Design
7 | {
8 | [TestClass]
9 | public class CategoryEditorContentPresenterTest
10 | {
11 | [TestMethod]
12 | public void ShouldAssignContentBindingByDefault()
13 | {
14 | CategoryEditorContentPresenter presenter = new CategoryEditorContentPresenter();
15 | BindingExpression expression = presenter.GetBindingExpression(ContentPresenter.ContentProperty);
16 | Assert.IsNotNull(expression);
17 | }
18 |
19 | [TestMethod]
20 | public void ShouldAssignContentTemplateBindingByDefault()
21 | {
22 | CategoryEditorContentPresenter presenter = new CategoryEditorContentPresenter();
23 | BindingExpression expression = presenter.GetBindingExpression(ContentPresenter.ContentTemplateProperty);
24 | Assert.IsNotNull(expression);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/CategoryItemsLayoutTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using System.Windows.Controls.WpfPropertyGrid.Design;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Design
7 | {
8 | [TestClass]
9 | public class CategoryItemsLayoutTest
10 | {
11 | #region Mock Objects
12 | private class CategoryItemsLayoutMock : CategoryItemsLayout
13 | {
14 | public DependencyObject CallContainerForItemOverride()
15 | {
16 | return this.GetContainerForItemOverride();
17 | }
18 |
19 | public void CallPrepareContainerForItemOverride(DependencyObject element, object item)
20 | {
21 | this.PrepareContainerForItemOverride(element, item);
22 | }
23 | }
24 |
25 | private class GridEntryMock : GridEntry
26 | {
27 | public override void ApplyFilter(PropertyFilter filter)
28 | {
29 | }
30 |
31 | public override bool MatchesPredicate(PropertyFilterPredicate predicate)
32 | {
33 | return false;
34 | }
35 | }
36 | #endregion
37 |
38 | [TestMethod]
39 | public void ShouldProvideCategoryContainerForItemOverride()
40 | {
41 | CategoryItemsLayoutMock layout = new CategoryItemsLayoutMock();
42 | DependencyObject container = layout.CallContainerForItemOverride();
43 |
44 | Assert.IsNotNull(container);
45 | Assert.IsInstanceOfType(container, typeof(CategoryContainer));
46 | }
47 |
48 | [TestMethod]
49 | public void ShouldAssignDataContextWithProvidedItem()
50 | {
51 | CategoryContainer container = new CategoryContainer();
52 | GridEntry item = new GridEntryMock();
53 |
54 | new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item);
55 |
56 | Assert.AreEqual(item, container.DataContext);
57 | }
58 |
59 | [TestMethod]
60 | public void ShouldAssignBindingWithProvidedItem()
61 | {
62 | CategoryContainer container = new CategoryContainer();
63 | GridEntry item = new GridEntryMock();
64 |
65 | new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item);
66 |
67 | var expression = container.GetBindingExpression(GridEntryContainer.EntryProperty);
68 | Assert.IsNotNull(expression);
69 | }
70 |
71 | [TestMethod]
72 | public void ShouldNotFailPreparingNonCategoryContainer()
73 | {
74 | new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(new DependencyObject(), "item");
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/PropertyContainerTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Design
5 | {
6 | [TestClass]
7 | public class PropertyContainerTest
8 | {
9 | private class PropertyContainerTestCase : PropertyContainer
10 | {
11 | public object GetDefaultStyleKeyValue()
12 | {
13 | return DefaultStyleKey;
14 | }
15 | }
16 |
17 | [TestMethod]
18 | public void ShouldOverrideDefaultStyle()
19 | {
20 | PropertyContainerTestCase container = new PropertyContainerTestCase();
21 | Assert.AreEqual(typeof(PropertyContainer), container.GetDefaultStyleKeyValue());
22 | }
23 |
24 | [TestMethod]
25 | public void ShouldAssignItselfAsParentContainer()
26 | {
27 | PropertyContainer container = new PropertyContainer();
28 | Assert.AreEqual(container, PropertyContainer.GetParentContainer(container));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/PropertyEditorContentPresenterTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using System.Windows.Data;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Design
7 | {
8 | [TestClass]
9 | public class PropertyEditorContentPresenterTest
10 | {
11 | [TestMethod]
12 | public void ShouldAssignContentBindingByDefault()
13 | {
14 | PropertyEditorContentPresenter presenter = new PropertyEditorContentPresenter();
15 | BindingExpression expression = presenter.GetBindingExpression(ContentPresenter.ContentProperty);
16 | Assert.IsNotNull(expression);
17 | }
18 |
19 | [TestMethod]
20 | public void ShouldAssignContentTemplateBindingByDefault()
21 | {
22 | PropertyEditorContentPresenter presenter = new PropertyEditorContentPresenter();
23 | BindingExpression expression = presenter.GetBindingExpression(ContentPresenter.ContentTemplateProperty);
24 | Assert.IsNotNull(expression);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/PropertyItemsLayoutTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using System.Windows.Controls.WpfPropertyGrid.Design;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Design
7 | {
8 | [TestClass]
9 | public class PropertyItemsLayoutTest
10 | {
11 | #region Mock Objects
12 | private class PropertyItemsLayoutMock : PropertyItemsLayout
13 | {
14 | public DependencyObject CallContainerForItemOverride()
15 | {
16 | return this.GetContainerForItemOverride();
17 | }
18 |
19 | public void CallPrepareContainerForItemOverride(DependencyObject element, object item)
20 | {
21 | this.PrepareContainerForItemOverride(element, item);
22 | }
23 | }
24 |
25 | private class GridEntryMock : GridEntry
26 | {
27 | public override void ApplyFilter(PropertyFilter filter)
28 | {
29 | }
30 |
31 | public override bool MatchesPredicate(PropertyFilterPredicate predicate)
32 | {
33 | return false;
34 | }
35 | }
36 | #endregion
37 |
38 | [TestMethod]
39 | public void ShouldProvideCategoryContainerForItemOverride()
40 | {
41 | PropertyItemsLayoutMock layout = new PropertyItemsLayoutMock();
42 | DependencyObject container = layout.CallContainerForItemOverride();
43 |
44 | Assert.IsNotNull(container);
45 | Assert.IsInstanceOfType(container, typeof(PropertyContainer));
46 | }
47 |
48 | [TestMethod]
49 | public void ShouldAssignDataContextWithProvidedItem()
50 | {
51 | PropertyContainer container = new PropertyContainer();
52 | GridEntry item = new GridEntryMock();
53 |
54 | new PropertyItemsLayoutMock().CallPrepareContainerForItemOverride(container, item);
55 |
56 | Assert.AreEqual(item, container.DataContext);
57 | }
58 |
59 | [TestMethod]
60 | public void ShouldAssignBindingWithProvidedItem()
61 | {
62 | PropertyContainer container = new PropertyContainer();
63 | GridEntry item = new GridEntryMock();
64 |
65 | new PropertyItemsLayoutMock().CallPrepareContainerForItemOverride(container, item);
66 |
67 | var expression = container.GetBindingExpression(GridEntryContainer.EntryProperty);
68 | Assert.IsNotNull(expression);
69 | }
70 |
71 | [TestMethod]
72 | public void ShouldNotFailPreparingNonCategoryContainer()
73 | {
74 | new PropertyItemsLayoutMock().CallPrepareContainerForItemOverride(new DependencyObject(), "item");
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/PropertyNameTextBlockTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using System.Windows.Input;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Design
7 | {
8 | [TestClass]
9 | public class PropertyNameTextBlockTest
10 | {
11 | [TestMethod]
12 | public void ShouldAssignDefaultPropertyValues()
13 | {
14 | PropertyNameTextBlock nameblock = new PropertyNameTextBlock();
15 | Assert.AreEqual(TextTrimming.CharacterEllipsis, nameblock.TextTrimming);
16 | Assert.AreEqual(TextWrapping.NoWrap, nameblock.TextWrapping);
17 | Assert.AreEqual(TextAlignment.Right, nameblock.TextAlignment);
18 | Assert.AreEqual(VerticalAlignment.Center, nameblock.VerticalAlignment);
19 | Assert.IsTrue(nameblock.ClipToBounds);
20 | Assert.IsFalse(KeyboardNavigation.GetIsTabStop(nameblock));
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Design/TabbedLayoutTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid.Design;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests.Layout
6 | {
7 | [TestClass]
8 | public class TabbedLayoutTest
9 | {
10 | private class TabbedLayoutMock : TabbedLayout
11 | {
12 | public object GetDefaultStyleKey()
13 | {
14 | return this.DefaultStyleKey;
15 | }
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldOverrideDefaultStyleKey()
20 | {
21 | Assert.AreEqual((Type)new TabbedLayoutMock().GetDefaultStyleKey(), typeof(TabbedLayout));
22 | }
23 |
24 | [TestMethod]
25 | [ExpectedException(typeof(ArgumentNullException))]
26 | public void ShouldFailSettingCanCloseForNull()
27 | {
28 | TabbedLayoutMock.SetCanClose(null, true);
29 | }
30 |
31 | [TestMethod]
32 | [ExpectedException(typeof(ArgumentNullException))]
33 | public void ShouldFailGettingCanCloseForNull()
34 | {
35 | TabbedLayoutMock.GetCanClose(null);
36 | }
37 |
38 | [TestMethod]
39 | public void ShouldSetCanCloseProperly()
40 | {
41 | TabbedLayoutMock target = new TabbedLayoutMock();
42 |
43 | TabbedLayoutMock.SetCanClose(target, true);
44 | Assert.AreEqual(true, TabbedLayoutMock.GetCanClose(target));
45 |
46 | TabbedLayoutMock.SetCanClose(target, false);
47 | Assert.AreEqual(false, TabbedLayoutMock.GetCanClose(target));
48 | }
49 |
50 | [TestMethod]
51 | [ExpectedException(typeof(ArgumentNullException))]
52 | public void ShouldFailSettingHeaderForNull()
53 | {
54 | TabbedLayoutMock.SetHeader(null, "header");
55 | }
56 |
57 | [TestMethod]
58 | [ExpectedException(typeof(ArgumentNullException))]
59 | public void ShouldFailGettingHeaderFromNull()
60 | {
61 | TabbedLayoutMock.GetHeader(null);
62 | }
63 |
64 | [TestMethod]
65 | public void ShouldReplaceNullHeaderWithDefault()
66 | {
67 | TabbedLayoutMock target = new TabbedLayoutMock();
68 |
69 | TabbedLayoutMock.SetHeader(target, "header");
70 | Assert.AreEqual("header", TabbedLayoutMock.GetHeader(target));
71 |
72 | TabbedLayoutMock.SetHeader(target, null);
73 | Assert.AreEqual(TabbedLayoutMock.DefaultHeader, TabbedLayoutMock.GetHeader(target));
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Internal/MathUtilTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid.Internal;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Internal
5 | {
6 | [TestClass]
7 | public class MathUtilTest
8 | {
9 | [TestMethod]
10 | public void ShouldValidateNumberWithinRange()
11 | {
12 | Assert.AreEqual(1, MathUtil.ValidateNumber(1, 1, 1));
13 | Assert.AreEqual(6, MathUtil.ValidateNumber(6, 5, 10));
14 | Assert.AreEqual(5, MathUtil.ValidateNumber(4, 5, 10));
15 | Assert.AreEqual(10, MathUtil.ValidateNumber(11, 5, 10));
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldValidateStringWithinRange()
20 | {
21 | Assert.AreEqual(0, MathUtil.ValidateNumber("wrong", 10, 20));
22 | Assert.AreEqual(1, MathUtil.ValidateNumber("1", 1, 1));
23 | Assert.AreEqual(6, MathUtil.ValidateNumber("6", 5, 10));
24 | Assert.AreEqual(5, MathUtil.ValidateNumber("4", 5, 10));
25 | Assert.AreEqual(10, MathUtil.ValidateNumber("11", 5, 10));
26 | }
27 |
28 | [TestMethod]
29 | public void ShouldIncrementStringNumber()
30 | {
31 | Assert.AreEqual(1, MathUtil.IncrementDecrementNumber("wrong", 0, 5, true));
32 | Assert.AreEqual(2, MathUtil.IncrementDecrementNumber("1", 0, 3, true));
33 | }
34 |
35 | [TestMethod]
36 | public void ShouldDecrementStringNumber()
37 | {
38 | Assert.AreEqual(0, MathUtil.IncrementDecrementNumber("wrong", -1, 0, false));
39 | Assert.AreEqual(1, MathUtil.IncrementDecrementNumber("2", 0, 3, false));
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/AttributesContainerTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using System;
4 | using System.ComponentModel;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Metadata
7 | {
8 | [TestClass]
9 | public class AttributesContainerTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(ArgumentNullException))]
13 | public void ShouldFailInitializingNull()
14 | {
15 | new AttributesContainer(null);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldInitializeWithCollection()
20 | {
21 | AttributeCollection collection = new AttributeCollection(new Attribute[] { new BrowsableAttribute(true), new ReadOnlyAttribute(true) });
22 | AttributesContainer container = new AttributesContainer(collection);
23 | Assert.IsNotNull(container["Browsable"]);
24 | Assert.IsNotNull(container["ReadOnly"]);
25 | }
26 |
27 | [TestMethod]
28 | public void ShouldReturnNullForMissingAttribute()
29 | {
30 | Assert.IsNull(new AttributesContainer(new AttributeCollection(new Attribute[0]))["Missing"]);
31 | }
32 |
33 | [TestMethod]
34 | public void ShouldNotRegisterEmptyName()
35 | {
36 | Assert.IsFalse(new AttributesContainer(new AttributeCollection(new Attribute[0])).RegisterAttribute(null, typeof(BrowsableAttribute)));
37 | }
38 |
39 | [TestMethod]
40 | public void ShouldNotRegisterEmptyType()
41 | {
42 | Assert.IsFalse(new AttributesContainer(new AttributeCollection(new Attribute[0])).RegisterAttribute("name", null));
43 | }
44 |
45 | [TestMethod]
46 | public void ShouldTrancateAttributeSuffix()
47 | {
48 | AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[0]));
49 | container.RegisterAttribute("ExternalAttribute", typeof(BrowsableAttribute));
50 | container.RegisterAttribute("Another", typeof(ReadOnlyAttribute));
51 | Assert.IsNotNull(container["External"]);
52 | Assert.IsNotNull(container["Another"]);
53 | }
54 |
55 | [TestMethod]
56 | public void ShouldNotRegisterAttribute()
57 | {
58 | AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[] { }));
59 | Assert.IsFalse(container.RegisterAttribute("Attribute", typeof(BrowsableAttribute)));
60 | }
61 |
62 | [TestMethod]
63 | public void ShouldRegisterAttributeOnlyOnce()
64 | {
65 | AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[0]));
66 | Assert.IsTrue(container.RegisterAttribute("One", typeof(BrowsableAttribute)));
67 | Assert.IsFalse(container.RegisterAttribute("One", typeof(BrowsableAttribute)));
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/BrowsableCategoryAttributeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Metadata
5 | {
6 | [TestClass]
7 | public class BrowsableCategoryAttributeTest
8 | {
9 | [TestMethod]
10 | public void ShouldApplyCategoryName()
11 | {
12 | BrowsableCategoryAttribute attribute = new BrowsableCategoryAttribute("category");
13 | Assert.AreEqual("category", attribute.CategoryName);
14 | }
15 |
16 | [TestMethod]
17 | public void ShouldApplyBrowsableState()
18 | {
19 | BrowsableCategoryAttribute attribute = new BrowsableCategoryAttribute(true);
20 | Assert.IsTrue(attribute.Browsable);
21 | }
22 |
23 | [TestMethod]
24 | public void ShouldApplyDefaultWildcard()
25 | {
26 | BrowsableCategoryAttribute attribute = new BrowsableCategoryAttribute(true);
27 | Assert.AreEqual(BrowsableCategoryAttribute.All, attribute.CategoryName);
28 | }
29 |
30 | [TestMethod]
31 | public void ShouldReplaceNullWithWildcard()
32 | {
33 | BrowsableCategoryAttribute attribute = new BrowsableCategoryAttribute(null, true);
34 | Assert.AreEqual(BrowsableCategoryAttribute.All, attribute.CategoryName);
35 | }
36 |
37 | [TestMethod]
38 | public void ShouldAssignBrowsableByDefault()
39 | {
40 | BrowsableCategoryAttribute attribute = new BrowsableCategoryAttribute("category");
41 | Assert.IsTrue(attribute.Browsable);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/BrowsablePropertyAttributeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Metadata
5 | {
6 | [TestClass]
7 | public class BrowsablePropertyAttributeTest
8 | {
9 | [TestMethod]
10 | public void ShouldApplyPropertyName()
11 | {
12 | BrowsablePropertyAttribute attribute = new BrowsablePropertyAttribute("property");
13 | Assert.AreEqual("property", attribute.PropertyName);
14 | }
15 |
16 | [TestMethod]
17 | public void ShouldApplyBrowsableState()
18 | {
19 | BrowsablePropertyAttribute attribute = new BrowsablePropertyAttribute(true);
20 | Assert.IsTrue(attribute.Browsable);
21 | }
22 |
23 | [TestMethod]
24 | public void ShouldApplyWildcard()
25 | {
26 | BrowsablePropertyAttribute attribute = new BrowsablePropertyAttribute(false);
27 | Assert.AreEqual(BrowsablePropertyAttribute.All, attribute.PropertyName);
28 | }
29 |
30 | [TestMethod]
31 | public void ShouldReplaceNullWithWildCard()
32 | {
33 | BrowsablePropertyAttribute attribute = new BrowsablePropertyAttribute(null);
34 | Assert.AreEqual(BrowsablePropertyAttribute.All, attribute.PropertyName);
35 | }
36 |
37 | [TestMethod]
38 | public void ShouldAssignBrowsableByDefault()
39 | {
40 | BrowsablePropertyAttribute attribute = new BrowsablePropertyAttribute("property");
41 | Assert.IsTrue(attribute.Browsable);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/NumberRangeAttributeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Metadata
5 | {
6 | [TestClass]
7 | public class NumberRangeAttributeTest
8 | {
9 | [TestMethod]
10 | public void ShouldAssignAllProperties()
11 | {
12 | NumberRangeAttribute attribute = new NumberRangeAttribute(10, 20, 30, 40);
13 | Assert.AreEqual(10, attribute.Minimum);
14 | Assert.AreEqual(20, attribute.Maximum);
15 | Assert.AreEqual(30, attribute.Tick);
16 | Assert.AreEqual(40, attribute.Precision);
17 | }
18 |
19 | [TestMethod]
20 | public void ShouldAssignPrecisionByDefault()
21 | {
22 | NumberRangeAttribute attribute = new NumberRangeAttribute(10, 20, 30);
23 | Assert.AreEqual(0, attribute.Precision);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/PropertyEditorAttributeTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests.Metadata
6 | {
7 | [TestClass]
8 | public class PropertyEditorAttributeTest
9 | {
10 | [TestMethod]
11 | [ExpectedException(typeof(ArgumentNullException))]
12 | public void ShouldFailForEmptyTypeName()
13 | {
14 | new PropertyEditorAttribute(string.Empty);
15 | }
16 |
17 | [TestMethod]
18 | [ExpectedException(typeof(NullReferenceException))]
19 | public void ShouldFailForEmptyType()
20 | {
21 | new PropertyEditorAttribute((Type)null);
22 | }
23 |
24 | [TestMethod]
25 | public void ShouldAssignTypeName()
26 | {
27 | PropertyEditorAttribute attribute = new PropertyEditorAttribute("TYPE");
28 | Assert.AreEqual("TYPE", attribute.EditorType);
29 | }
30 |
31 | [TestMethod]
32 | public void ShouldAssignType()
33 | {
34 | PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(string));
35 | Assert.AreEqual(typeof(string).AssemblyQualifiedName, attribute.EditorType);
36 | }
37 |
38 | [TestMethod]
39 | public void ShouldReturnEqualtyForSameInstance()
40 | {
41 | PropertyEditorAttribute attribute = new PropertyEditorAttribute("type");
42 | Assert.IsTrue(attribute.Equals(attribute));
43 | }
44 |
45 | [TestMethod]
46 | public void ShouldReturnEqualtyByNames()
47 | {
48 | PropertyEditorAttribute attribute1 = new PropertyEditorAttribute("type");
49 | PropertyEditorAttribute attribute2 = new PropertyEditorAttribute("type");
50 |
51 | Assert.IsTrue(attribute1.Equals(attribute2));
52 | Assert.IsTrue(attribute2.Equals(attribute1));
53 | }
54 |
55 | [TestMethod]
56 | public void ShouldReturnEqualtyWithNull()
57 | {
58 | Assert.IsFalse(new PropertyEditorAttribute("type").Equals(null));
59 | }
60 |
61 | [TestMethod]
62 | public void ShouldReturnTypeNameBasedHashCode()
63 | {
64 | int hash1 = new PropertyEditorAttribute("type").GetHashCode();
65 | int hash2 = new PropertyEditorAttribute("type").GetHashCode();
66 | int hash3 = new PropertyEditorAttribute("newtype").GetHashCode();
67 |
68 | Assert.AreEqual(hash1, hash2);
69 | Assert.AreNotEqual(hash1, hash3);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Metadata/PropertyOrderAttributeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.Metadata
5 | {
6 | [TestClass]
7 | public class PropertyOrderAttributeTest
8 | {
9 | [TestMethod]
10 | public void ShouldAssignOrder()
11 | {
12 | PropertyOrderAttribute attribute = new PropertyOrderAttribute(10);
13 | Assert.AreEqual(10, attribute.Order);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("WpfPropertyGrid.UnitTests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("WpfPropertyGrid.UnitTests")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM componenets. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fb9434b7-d42d-45e3-8671-5fbdd488e325")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditing/CategoryItemComparerTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests.PropertyEditing
5 | {
6 | [TestClass]
7 | public class CategoryItemComparerTest
8 | {
9 | [TestMethod]
10 | public void ComparesNullToNull()
11 | {
12 | int result = new CategoryItemComparer().Compare(null, null);
13 | Assert.AreEqual(0, result);
14 | }
15 |
16 | [TestMethod]
17 | public void ComparesNullToValue()
18 | {
19 | int result = new CategoryItemComparer().Compare(null, new CategoryItem(new PropertyGrid(), "name"));
20 | Assert.AreEqual(-1, result);
21 | }
22 |
23 | [TestMethod]
24 | public void ComparesValueToNull()
25 | {
26 | int result = new CategoryItemComparer().Compare(new CategoryItem(new PropertyGrid(), "name"), null);
27 | Assert.AreEqual(1, result);
28 | }
29 |
30 | [TestMethod]
31 | public void ComparesValuesByNames()
32 | {
33 | Assert.AreEqual(0, new CategoryItemComparer().Compare(new CategoryItem(new PropertyGrid(), "name"), new CategoryItem(new PropertyGrid(), "name")));
34 | Assert.AreEqual(-1, new CategoryItemComparer().Compare(new CategoryItem(new PropertyGrid(), "a"), new CategoryItem(new PropertyGrid(), "b")));
35 | Assert.AreEqual(1, new CategoryItemComparer().Compare(new CategoryItem(new PropertyGrid(), "b"), new CategoryItem(new PropertyGrid(), "a")));
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditing/Filters/PropertyFilterPredicateTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using System;
4 |
5 | namespace WpfPropertyGrid.UnitTests.PropertyEditing.Filters
6 | {
7 | [TestClass]
8 | public class PropertyFilterPredicateTest
9 | {
10 | [TestMethod]
11 | [ExpectedException(typeof(ArgumentNullException))]
12 | public void ShouldFailForEmptyMatchText()
13 | {
14 | new PropertyFilterPredicate(null);
15 | }
16 |
17 | [TestMethod]
18 | public void ShouldInitializeMatchTextUpperCased()
19 | {
20 | PropertyFilterPredicate predicate = new PropertyFilterPredicate("test");
21 | Assert.AreEqual("TEST", predicate.MatchText);
22 | }
23 |
24 | [TestMethod]
25 | public void ShouldNotMatchNullText()
26 | {
27 | Assert.IsFalse(new PropertyFilterPredicate("test").Match(null));
28 | }
29 |
30 | [TestMethod]
31 | public void ShouldMatchText()
32 | {
33 | PropertyFilterPredicate predicate = new PropertyFilterPredicate("test");
34 | Assert.IsTrue(predicate.Match("Test"));
35 | Assert.IsTrue(predicate.Match("TestMe"));
36 | Assert.IsTrue(predicate.Match("ThisIsATest"));
37 |
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditing/Filters/PropertyFilterTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Controls.WpfPropertyGrid;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.PropertyEditing.Filters
7 | {
8 | [TestClass]
9 | public class PropertyFilterTest
10 | {
11 | private class PropertyFilterTargetTestCase : IPropertyFilterTarget
12 | {
13 | public string Name { get; private set; }
14 |
15 | public PropertyFilterTargetTestCase(string name)
16 | {
17 | this.Name = name;
18 | }
19 |
20 | #region IPropertyFilterTarget Members
21 |
22 | public event EventHandler FilterApplied;
23 |
24 | private void OnFilterApplied()
25 | {
26 | if (FilterApplied != null) FilterApplied(this, null);
27 | }
28 |
29 | public void ApplyFilter(PropertyFilter filter)
30 | {
31 | this.MatchesFilter = (filter == null) || filter.Match(this);
32 | }
33 |
34 | public bool MatchesPredicate(PropertyFilterPredicate predicate)
35 | {
36 | if (predicate == null) return false;
37 | return predicate.Match(this.Name);
38 | }
39 |
40 | public bool MatchesFilter { get; protected set; }
41 |
42 | #endregion
43 | }
44 |
45 | [TestMethod]
46 | public void ShouldInitializeWithNullValue()
47 | {
48 | PropertyFilter filter = new PropertyFilter((IEnumerable)null);
49 | Assert.IsTrue(filter.IsEmpty);
50 | }
51 |
52 | [TestMethod]
53 | public void ShouldInitiaizeWithPredicatesCollection()
54 | {
55 | PropertyFilter filter = new PropertyFilter(new PropertyFilterPredicate[] { new PropertyFilterPredicate("test"), new PropertyFilterPredicate("me") });
56 | Assert.IsFalse(filter.IsEmpty);
57 | }
58 |
59 | [TestMethod]
60 | [ExpectedException(typeof(ArgumentNullException))]
61 | public void ShouldFailMatchingToNullValue()
62 | {
63 | PropertyFilter filter = new PropertyFilter("test");
64 | filter.Match(null);
65 | }
66 |
67 | [TestMethod]
68 | public void ShouldPerformMatch()
69 | {
70 | PropertyFilter filter = new PropertyFilter("test");
71 | Assert.IsTrue(filter.Match(new PropertyFilterTargetTestCase("test")));
72 | Assert.IsFalse(filter.Match(new PropertyFilterTargetTestCase("missing")));
73 | }
74 |
75 | [TestMethod]
76 | public void ShouldReturnPositiveMatchWhenEmpty()
77 | {
78 | PropertyFilter filter = new PropertyFilter((string)null);
79 | Assert.IsTrue(filter.Match(new PropertyFilterTargetTestCase("test")));
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditing/NamedColorTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using System.Windows.Media;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 |
6 | namespace WpfPropertyGrid.UnitTests.Data
7 | {
8 | [TestClass]
9 | public class NamedColorTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(ArgumentNullException))]
13 | public void ShouldFailForEmptyName()
14 | {
15 | new NamedColor(null, Colors.AliceBlue);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldInitializeProperties()
20 | {
21 | NamedColor color = new NamedColor("color", Colors.AliceBlue);
22 |
23 | Assert.AreEqual("color", color.Name);
24 | Assert.AreEqual(Colors.AliceBlue, color.Color);
25 | Assert.IsNotNull(color.Brush);
26 | }
27 |
28 | [TestMethod]
29 | public void ShouldFreezeBrush()
30 | {
31 | NamedColor color = new NamedColor("color", Colors.AliceBlue);
32 | Assert.IsTrue(color.Brush.IsFrozen);
33 | }
34 |
35 | [TestMethod]
36 | public void ShouldReturnNameWhenConvertedToString()
37 | {
38 | NamedColor color = new NamedColor("name", Colors.AliceBlue);
39 | Assert.AreEqual("name", color.ToString());
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditing/ValueExceptionEventArgsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests.PropertyEditing
6 | {
7 | [TestClass]
8 | public class ValueExceptionEventArgsTest
9 | {
10 | private class PropertyItemMock : PropertyItem
11 | {
12 | public PropertyItemMock() : base(null) { }
13 | }
14 |
15 | private class PropertyItemValueMock : PropertyItemValue
16 | {
17 | public PropertyItemValueMock() : base(new PropertyItemMock()) { }
18 | }
19 |
20 | [TestMethod]
21 | [ExpectedException(typeof(ArgumentNullException))]
22 | public void ShouldFailForEmptyMessage()
23 | {
24 | new ValueExceptionEventArgs(null, new PropertyItemValueMock(), ValueExceptionSource.Get, new Exception());
25 | }
26 |
27 | [TestMethod]
28 | [ExpectedException(typeof(ArgumentNullException))]
29 | public void ShouldFailForNullPropertyItemValue()
30 | {
31 | new ValueExceptionEventArgs("message", null, ValueExceptionSource.Get, new Exception());
32 | }
33 |
34 | [TestMethod]
35 | [ExpectedException(typeof(ArgumentNullException))]
36 | public void ShouldFailForException()
37 | {
38 | new ValueExceptionEventArgs("message", new PropertyItemValueMock(), ValueExceptionSource.Get, null);
39 | }
40 |
41 | [TestMethod]
42 | [Ignore]
43 | public void ShouldAssignAllPropertiesFromConstructor()
44 | {
45 | PropertyItemValueMock value = new PropertyItemValueMock();
46 | Exception exception = new Exception();
47 |
48 | ValueExceptionEventArgs arguments = new ValueExceptionEventArgs("message", value, ValueExceptionSource.Get, exception);
49 |
50 | Assert.AreEqual("message", arguments.Message);
51 | Assert.AreEqual(value, arguments.PropertyValue);
52 | Assert.AreEqual(ValueExceptionSource.Get, arguments.Source);
53 | Assert.AreEqual(exception, arguments.Exception);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyEditorTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 | using System.Windows;
5 |
6 | namespace WpfPropertyGrid.UnitTests
7 | {
8 | [TestClass]
9 | public class PropertyEditorTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(ArgumentNullException))]
13 | public void ExpectsDeclaringTypeProvided()
14 | {
15 | new PropertyEditor(null, "name");
16 | }
17 |
18 | [TestMethod]
19 | [ExpectedException(typeof(ArgumentNullException))]
20 | public void ExpectsPropertyNameProvided()
21 | {
22 | new PropertyEditor(typeof(string), null);
23 | }
24 |
25 | [TestMethod]
26 | public void AssignsDeclaringTypeProperty()
27 | {
28 | PropertyEditor editor = new PropertyEditor(typeof(string), "name");
29 | Assert.AreEqual(typeof(string), editor.DeclaringType);
30 |
31 | editor = new PropertyEditor { DeclaringType = typeof(int) };
32 | Assert.AreEqual(typeof(int), editor.DeclaringType);
33 | }
34 |
35 | [TestMethod]
36 | public void AssignsPropertyNameProperty()
37 | {
38 | PropertyEditor editor = new PropertyEditor(typeof(string), "name");
39 | Assert.AreEqual("name", editor.PropertyName);
40 |
41 | editor = new PropertyEditor { PropertyName = "name" };
42 | Assert.AreEqual("name", editor.PropertyName);
43 | }
44 |
45 | [TestMethod]
46 | public void AssignsInlineTemplate()
47 | {
48 | DataTemplate template = new DataTemplate();
49 | Editor editor = new PropertyEditor(typeof(string), "name", template);
50 | Assert.AreEqual(template, editor.InlineTemplate);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyFilterAppliedEventArgsTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls.WpfPropertyGrid;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 |
4 | namespace WpfPropertyGrid.UnitTests
5 | {
6 | [TestClass]
7 | public class PropertyFilterAppliedEventArgsTest
8 | {
9 | [TestMethod]
10 | public void ShouldInitializeFilter()
11 | {
12 | PropertyFilter filter = new PropertyFilter("test");
13 | PropertyFilterAppliedEventArgs args = new PropertyFilterAppliedEventArgs(filter);
14 |
15 | Assert.AreEqual(filter, args.Filter);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyGridUtilsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 | using System.Linq;
5 |
6 | namespace WpfPropertyGrid.UnitTests
7 | {
8 | [TestClass]
9 | public class PropertyGridUtilsTest
10 | {
11 | [BrowsableCategory("category1", false)]
12 | [BrowsableCategory("category2", true)]
13 | private class PropertyGridUtilsTestCase
14 | {
15 | }
16 |
17 | [TestMethod]
18 | [ExpectedException(typeof(ArgumentNullException))]
19 | public void ShouldFailForNullObject()
20 | {
21 | PropertyGridUtils.GetAttributes((object)null);
22 | }
23 |
24 | [TestMethod]
25 | [ExpectedException(typeof(ArgumentNullException))]
26 | public void ShouldFailForNullType()
27 | {
28 | PropertyGridUtils.GetAttributes((Type)null);
29 | }
30 |
31 | [TestMethod]
32 | [Ignore] // TODO: This test is not reliable as Reflection does not always return the same order
33 | public void ShouldReturnAttributesForType()
34 | {
35 | var attributes = PropertyGridUtils.GetAttributes(typeof(PropertyGridUtilsTestCase));
36 |
37 | Assert.AreEqual(2, attributes.Count());
38 |
39 | Assert.AreEqual("category1", attributes.First().CategoryName);
40 | Assert.IsFalse(attributes.First().Browsable);
41 |
42 | Assert.AreEqual("category2", attributes.Last().CategoryName);
43 | Assert.IsTrue(attributes.Last().Browsable);
44 | }
45 |
46 | [TestMethod]
47 | [Ignore] // TODO: This test is not reliable as Reflection does not always return the same order
48 | public void ShouldReturnAttributesByInstance()
49 | {
50 | var attributes = PropertyGridUtils.GetAttributes(new PropertyGridUtilsTestCase());
51 |
52 | Assert.AreEqual(2, attributes.Count());
53 |
54 | Assert.AreEqual("category1", attributes.First().CategoryName);
55 | Assert.IsFalse(attributes.First().Browsable);
56 |
57 | Assert.AreEqual("category2", attributes.Last().CategoryName);
58 | Assert.IsTrue(attributes.Last().Browsable);
59 | }
60 |
61 | [TestMethod]
62 | public void ShoudReturnEmptyAttributeSequence()
63 | {
64 | var attributes = PropertyGridUtils.GetAttributes(typeof(PropertyGridUtilsTestCase));
65 |
66 | Assert.IsNotNull(attributes);
67 | Assert.AreEqual(0, attributes.Count());
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/PropertyValueChangedEventArgsTest.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace WpfPropertyGrid.UnitTests
6 | {
7 | [TestClass]
8 | public class PropertyValueChangedEventArgsTest
9 | {
10 | private class PropertyItemTestCase : PropertyItem
11 | {
12 | public PropertyItemTestCase() : base(null) { }
13 | }
14 |
15 | [TestMethod]
16 | [Ignore]
17 | public void ShouldInitializeProperties()
18 | {
19 | PropertyItem oldValue = new PropertyItemTestCase();
20 | PropertyItem newValue = new PropertyItemTestCase();
21 |
22 | PropertyValueChangedEventArgs args = new PropertyValueChangedEventArgs(PropertyGrid.PropertyValueChangedEvent, newValue, oldValue);
23 |
24 | Assert.AreEqual(PropertyGrid.PropertyValueChangedEvent, args.RoutedEvent);
25 | Assert.AreEqual(newValue, args.Property);
26 | Assert.AreEqual(oldValue, args.OldValue as PropertyItem);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/TypeEditorTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls.WpfPropertyGrid;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 | using System.Windows;
5 |
6 | namespace WpfPropertyGrid.UnitTests
7 | {
8 | [TestClass]
9 | public class TypeEditorTest
10 | {
11 | [TestMethod]
12 | [ExpectedException(typeof(ArgumentNullException))]
13 | public void ExpectsEditedTypeToBeDefined()
14 | {
15 | new TypeEditor(null);
16 | }
17 |
18 | [TestMethod]
19 | public void ShouldAssignEditedType()
20 | {
21 | TypeEditor editor = new TypeEditor(typeof(string));
22 |
23 | Assert.AreEqual(typeof(string), editor.EditedType);
24 | }
25 |
26 | [TestMethod]
27 | public void ShouldAssignInlineTemplate()
28 | {
29 | DataTemplate template = new DataTemplate();
30 | Editor editor = new TypeEditor(typeof(string), template);
31 |
32 | Assert.AreEqual(template, editor.InlineTemplate);
33 | }
34 |
35 | [TestMethod]
36 | public void ShouldAssignInlineAndExtendedTemplates()
37 | {
38 | DataTemplate template1 = new DataTemplate();
39 | DataTemplate template2 = new DataTemplate();
40 | Editor editor = new TypeEditor(typeof(string), template1, template2);
41 |
42 | Assert.AreEqual(template1, editor.InlineTemplate);
43 | Assert.AreEqual(template2, editor.ExtendedTemplate);
44 | }
45 |
46 | [TestMethod]
47 | public void AcceptsDataTemplateForTemplates()
48 | {
49 | DataTemplate template = new DataTemplate();
50 | Editor editor = new TypeEditor { InlineTemplate = template, ExtendedTemplate = template, DialogTemplate = template };
51 |
52 | Assert.AreEqual(template, editor.InlineTemplate);
53 | Assert.AreEqual(template, editor.ExtendedTemplate);
54 | Assert.AreEqual(template, editor.DialogTemplate);
55 | }
56 |
57 | [TestMethod]
58 | public void AcceptsResourceKeyForTemplates()
59 | {
60 | ComponentResourceKey key = new ComponentResourceKey();
61 | Editor editor = new TypeEditor { InlineTemplate = key, ExtendedTemplate = key, DialogTemplate = key };
62 |
63 | Assert.AreEqual(key, editor.InlineTemplate);
64 | Assert.AreEqual(key, editor.ExtendedTemplate);
65 | Assert.AreEqual(key, editor.DialogTemplate);
66 | }
67 |
68 | [TestMethod]
69 | [ExpectedException(typeof(ArgumentException))]
70 | public void ValidatesNotSupportedTemplateValues()
71 | {
72 | Editor editor = new TypeEditor(typeof(string), "WRONG_VALUE");
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Tests/WPG.UnitTests/WpfPropertyGrid.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DenysVuika/WPG/d99409ef377f6bd08309c84ea50980ebd182c618/Tests/WPG.UnitTests/WpfPropertyGrid.snk
--------------------------------------------------------------------------------
/WpfPropertyGrid1.vsmdi:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------