@ -1,12 +1,30 @@
using Samples.Infrastructure.Controls ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
using System.ComponentModel ;
using System.Collections.Generic ;
Extended WPF Toolkit
Copyright ( C ) 2 0 1 0 - 2 0 1 2 Xceed Software Inc .
This program is provided to you under the terms of the Microsoft Reciprocal
License ( Ms - RL ) as published at http : //wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc . under a
proprietary commercial license agreement for use in non - Open Source
projects . The commercial version of Extended WPF Toolkit also includes
priority technical support , commercial updates , and many additional
useful WPF controls if you license Xceed Business Suite for WPF .
Visit http : //xceed.com and follow @datagrid on Twitter.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
using System ;
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Windows ;
using System.Windows ;
using System.Windows.Media ;
using System.Windows.Controls ;
using System.Windows.Controls ;
using System.Windows.Data ;
using System.Windows.Data ;
using System.Windows.Media ;
using Microsoft.Practices.Prism.Regions ;
using Microsoft.Practices.Prism.Regions ;
using Samples.Infrastructure.Controls ;
namespace Samples.Modules.PropertyGrid.Views
namespace Samples.Modules.PropertyGrid.Views
{
{
@ -28,63 +46,115 @@ namespace Samples.Modules.PropertyGrid.Views
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "First Name" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get ; set ; }
public string FirstName
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Last Name" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName { get ; set ; }
public string LastName
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth { get ; set ; }
public DateTime DateOfBirth
{
get ;
set ;
}
[DisplayName( "Grade Point Average" )]
[DisplayName( "Grade Point Average" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double GradePointAvg { get ; set ; }
public double GradePointAvg
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[Description( "This property uses the IntegerUpDown as the default editor." )]
[Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age { get ; set ; }
public int Age
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Is Male" )]
[DisplayName( "Is Male" )]
[Description( "This property uses a CheckBox as the default editor." )]
[Description( "This property uses a CheckBox as the default editor." )]
public bool IsMale { get ; set ; }
public bool IsMale
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Favorite Color" )]
[DisplayName( "Favorite Color" )]
[Description( "This property uses the ColorPicker as the default editor." )]
[Description( "This property uses the ColorPicker as the default editor." )]
public Color FavoriteColor { get ; set ; }
public Color FavoriteColor
{
get ;
set ;
}
[Category( "Writing" )]
[Category( "Writing" )]
[DisplayName( "Writing Hand" )]
[DisplayName( "Writing Hand" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public HorizontalAlignment WritingHand { get ; set ; }
public HorizontalAlignment WritingHand
{
get ;
set ;
}
[Category( "Writing" )]
[Category( "Writing" )]
[DisplayName( "Writing Font" )]
[DisplayName( "Writing Font" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont { get ; set ; }
public FontFamily WritingFont
{
get ;
set ;
}
[Category( "Writing" )]
[Category( "Writing" )]
[DisplayName( "Writing Font Size" )]
[DisplayName( "Writing Font Size" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double WritingFontSize { get ; set ; }
public double WritingFontSize
{
get ;
set ;
}
[Category( "Conections" )]
[Category( "Conections" )]
[DisplayName( "Pet Names" )]
[DisplayName( "Pet Names" )]
[Description( "This property uses the PrimitiveTypeCollectionEditor as the default editor." )]
[Description( "This property uses the PrimitiveTypeCollectionEditor as the default editor." )]
public List < String > PetNames { get ; set ; }
public List < String > PetNames
{
get ;
set ;
}
[Category( "Conections" )]
[Category( "Conections" )]
[Description( "This property uses the CollectionEditor as the default editor." )]
[Description( "This property uses the CollectionEditor as the default editor." )]
public List < Person > Friends { get ; set ; }
public List < Person > Friends
{
get ;
set ;
}
[Category( "Conections" )]
[Category( "Conections" )]
[Description( "This property is a complex property and has no default editor." )]
[Description( "This property is a complex property and has no default editor." )]
public Person Spouse { get ; set ; }
public Person Spouse
{
get ;
set ;
}
public static Person CreatePerson ( )
public static Person CreatePerson ( )
{
{
@ -101,7 +171,11 @@ namespace Samples.Modules.PropertyGrid.Views
person . WritingFontSize = 1 2.5 ;
person . WritingFontSize = 1 2.5 ;
person . PetNames = new List < string > ( ) { "Pet 1" , "Pet 2" , "Pet 3" } ;
person . PetNames = new List < string > ( ) { "Pet 1" , "Pet 2" , "Pet 3" } ;
person . Friends = new List < Person > ( ) { new Person ( ) { FirstName = "First" , LastName = "Friend" } , new Person ( ) { FirstName = "Second" , LastName = "Friend" } } ;
person . Friends = new List < Person > ( ) { new Person ( ) { FirstName = "First" , LastName = "Friend" } , new Person ( ) { FirstName = "Second" , LastName = "Friend" } } ;
person . Spouse = new Person ( ) { FirstName = "Jane" , LastName = "Doe" } ;
person . Spouse = new Person ( )
{
FirstName = "Jane" ,
LastName = "Doe"
} ;
return person ;
return person ;
}
}
}
}
@ -113,19 +187,31 @@ namespace Samples.Modules.PropertyGrid.Views
[Description( "This property uses a TextBox as the default editor." )]
[Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a Class that implements the ITypeEditor interface
//This custom editor is a Class that implements the ITypeEditor interface
[Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
[Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
public string FirstName { get ; set ; }
public string FirstName
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Last Name" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
[Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a UserControl that implements the ITypeEditor interface
//This custom editor is a UserControl that implements the ITypeEditor interface
[Editor( typeof( LastNameUserControlEditor ), typeof( LastNameUserControlEditor ) )]
[Editor( typeof( LastNameUserControlEditor ), typeof( LastNameUserControlEditor ) )]
public string LastName { get ; set ; }
public string LastName
{
get ;
set ;
}
[Category( "Information" )]
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth { get ; set ; }
public DateTime DateOfBirth
{
get ;
set ;
}
public static CustomAttributEditorPerson CreateCustomAttributEditorPerson ( )
public static CustomAttributEditorPerson CreateCustomAttributEditorPerson ( )
{
{