billw2012
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
33 additions and
13 deletions
-
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt
-
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/PropertyGrid/Views/PropertyGridDefaultEditorsView.xaml.cs
-
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControl.cs
|
|
|
@ -171,9 +171,15 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views |
|
|
|
public Person Person { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
public class Person |
|
|
|
public class Person : ICloneable |
|
|
|
{ |
|
|
|
[ReadOnly(true)] |
|
|
|
public Guid UniqueID { get; set; } = Guid.NewGuid(); |
|
|
|
public string Name { get; set; } |
|
|
|
public object Clone() |
|
|
|
{ |
|
|
|
return new Person { Name = Name }; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -171,9 +171,15 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views |
|
|
|
public Person Person { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
public class Person |
|
|
|
public class Person : ICloneable |
|
|
|
{ |
|
|
|
[ReadOnly(true)] |
|
|
|
public Guid UniqueID { get; set; } = Guid.NewGuid(); |
|
|
|
public string Name { get; set; } |
|
|
|
public object Clone() |
|
|
|
{ |
|
|
|
return new Person { Name = Name }; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -539,20 +539,28 @@ namespace Xceed.Wpf.Toolkit |
|
|
|
|
|
|
|
var baseItem = e.Parameter; |
|
|
|
var newItemType = baseItem.GetType(); |
|
|
|
var newItem = this.CreateNewItem( newItemType ); |
|
|
|
|
|
|
|
var type = newItemType; |
|
|
|
while( type != null ) |
|
|
|
if (typeof(ICloneable).IsAssignableFrom(newItemType)) |
|
|
|
{ |
|
|
|
var baseProperties = type.GetFields( BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance ); |
|
|
|
foreach( var prop in baseProperties ) |
|
|
|
{ |
|
|
|
prop.SetValue( newItem, prop.GetValue( baseItem ) ); |
|
|
|
} |
|
|
|
type = type.BaseType; |
|
|
|
return ((ICloneable) baseItem).Clone(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var newItem = this.CreateNewItem(newItemType); |
|
|
|
|
|
|
|
return newItem; |
|
|
|
var type = newItemType; |
|
|
|
while (type != null) |
|
|
|
{ |
|
|
|
var baseProperties = type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); |
|
|
|
foreach (var prop in baseProperties) |
|
|
|
{ |
|
|
|
prop.SetValue(newItem, prop.GetValue(baseItem)); |
|
|
|
} |
|
|
|
|
|
|
|
type = type.BaseType; |
|
|
|
} |
|
|
|
|
|
|
|
return newItem; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void MoveDown( object sender, ExecutedRoutedEventArgs e ) |
|
|
|
|