Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 954988f

Browse files
Merge pull request #469 from gumme/WpfDesignerPropertyGridInterface
Created Interface to be able to customize PropertyGrid
2 parents 793c6a1 + 8b8cdfb commit 954988f

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,20 @@
3535

3636
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
3737
{
38-
public class PropertyGrid : INotifyPropertyChanged
38+
public interface IPropertyGrid
39+
{
40+
IEnumerable<DesignItem> SelectedItems { get; set; }
41+
Dictionary<MemberDescriptor, PropertyNode> NodeFromDescriptor { get; }
42+
DesignItem SingleItem { get; }
43+
string Name { get; set; }
44+
string OldName { get; }
45+
bool IsNameCorrect { get; set; }
46+
bool ReloadActive { get; }
47+
event EventHandler AggregatePropertiesUpdated;
48+
event PropertyChangedEventHandler PropertyChanged;
49+
}
50+
51+
public class PropertyGrid : INotifyPropertyChanged, IPropertyGrid
3952
{
4053
public PropertyGrid()
4154
{
@@ -54,7 +67,8 @@ public PropertyGrid()
5467
Category attachedCategory = new Category("Attached");
5568

5669
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>();
57-
70+
public Dictionary<MemberDescriptor, PropertyNode> NodeFromDescriptor { get { return nodeFromDescriptor; } }
71+
public event EventHandler AggregatePropertiesUpdated;
5872
public CategoriesCollection Categories { get; private set; }
5973
public PropertyNodeCollection Events { get; private set; }
6074

@@ -220,6 +234,8 @@ void Reload()
220234
}
221235
} finally {
222236
reloadActive = false;
237+
if (AggregatePropertiesUpdated != null)
238+
AggregatePropertiesUpdated(this, EventArgs.Empty);
223239
}
224240
}
225241

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ static PropertyGridView()
4343
}
4444

4545

46-
public PropertyGridView()
46+
public PropertyGridView() : this(null)
4747
{
48-
PropertyGrid = new PropertyGrid();
48+
}
49+
50+
public PropertyGridView(IPropertyGrid pg)
51+
{
52+
PropertyGrid = pg??new PropertyGrid();
4953
DataContext = PropertyGrid;
5054
}
5155

@@ -61,7 +65,7 @@ public override void OnApplyTemplate()
6165

6266
static PropertyContextMenu propertyContextMenu = new PropertyContextMenu();
6367

64-
public PropertyGrid PropertyGrid { get; private set; }
68+
public IPropertyGrid PropertyGrid { get; private set; }
6569

6670
public static readonly DependencyProperty FirstColumnWidthProperty =
6771
DependencyProperty.Register("FirstColumnWidth", typeof(double), typeof(PropertyGridView),

0 commit comments

Comments
 (0)