Browse Source

Merge pull request #469 from gumme/WpfDesignerPropertyGridInterface

Created Interface to be able to customize PropertyGrid
pull/520/head
Siegfried Pammer 11 years ago
parent
commit
954988f921
  1. 20
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs
  2. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.cs

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

@ -35,7 +35,20 @@ using System.Windows; @@ -35,7 +35,20 @@ using System.Windows;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
{
public class PropertyGrid : INotifyPropertyChanged
public interface IPropertyGrid
{
IEnumerable<DesignItem> SelectedItems { get; set; }
Dictionary<MemberDescriptor, PropertyNode> NodeFromDescriptor { get; }
DesignItem SingleItem { get; }
string Name { get; set; }
string OldName { get; }
bool IsNameCorrect { get; set; }
bool ReloadActive { get; }
event EventHandler AggregatePropertiesUpdated;
event PropertyChangedEventHandler PropertyChanged;
}
public class PropertyGrid : INotifyPropertyChanged, IPropertyGrid
{
public PropertyGrid()
{
@ -54,7 +67,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -54,7 +67,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
Category attachedCategory = new Category("Attached");
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>();
public Dictionary<MemberDescriptor, PropertyNode> NodeFromDescriptor { get { return nodeFromDescriptor; } }
public event EventHandler AggregatePropertiesUpdated;
public CategoriesCollection Categories { get; private set; }
public PropertyNodeCollection Events { get; private set; }
@ -220,6 +234,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -220,6 +234,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
}
} finally {
reloadActive = false;
if (AggregatePropertiesUpdated != null)
AggregatePropertiesUpdated(this, EventArgs.Empty);
}
}

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

@ -43,9 +43,13 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -43,9 +43,13 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
}
public PropertyGridView()
public PropertyGridView() : this(null)
{
PropertyGrid = new PropertyGrid();
}
public PropertyGridView(IPropertyGrid pg)
{
PropertyGrid = pg??new PropertyGrid();
DataContext = PropertyGrid;
}
@ -61,7 +65,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -61,7 +65,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
static PropertyContextMenu propertyContextMenu = new PropertyContextMenu();
public PropertyGrid PropertyGrid { get; private set; }
public IPropertyGrid PropertyGrid { get; private set; }
public static readonly DependencyProperty FirstColumnWidthProperty =
DependencyProperty.Register("FirstColumnWidth", typeof(double), typeof(PropertyGridView),

Loading…
Cancel
Save