Diagram for .NET / User's Guide / WinForm Components / Property Browser

Property Browser

The property browser is a user control, which can be used for the visual editing of the selection anchor, active layer, document or view properties. It is represented by an instance of the NPropertyBrowser class. The visibility of the property browser can be controlled by the manager if the PropertyBrowser property of the NDiagramCommandBarsManager is set to it.

C#
Copy Code
// create a new manager and property browser
NDiagramCommandBarsManager manager = new NDiagramCommandBarsManager();
NPropertyBrowser browser = new NPropertyBrowser();

...

// attach the property browser to the manager
manager.PropertyBrowser = browser;
Visual Basic
Copy Code
' create a new manager and property browser
Dim manager As New NDiagramCommandBarsManager
Dim browser As New NPropertyBrowser

...

' attach the property browser to the manager
manager.PropertyBrowser = browser

You must also explicitly connect the property browser to a valid view. This is achieved by setting its View property:

C#
Copy Code
// specify the view connected with the property browser
browser.View = view;
Visual Basic
Copy Code
' specify the view connected with the property browser
browser.View = view
 Property Browser Mode

The mode of the property browser determines the object whose properties are currently being displayed by the browser. It is controlled by the Mode property, which can take one of the following values:

  • Selection Anchor - in this mode the browser will show the properties of the current selection anchor. When the selection anchor node changes the browser will automatically update itself.
  • Document - in this mode the browser will show the properties of the document currently connected to the edited view.
  • Active Layer - in this mode the browser will show the properties of the currently active document layer.
  • View  - in this mode the browser shows the properties of the view to which it is connected.

The following code instructs the browser to show the properties of the currently active layer: 

C#
Copy Code
// show the properties of the currently active layer
browser.Mode = PropertyBrowserMode.ActiveLayer;
Visual Basic
Copy Code
' show the properties of the currently active layer
browser.Mode = PropertyBrowserMode.ActiveLayer
 Property Browser Updates
The property browser uses a property grid to display the properties of the edited object. The property grid displays a snapshot of the object properties, which are not automatically updated when the object properties change (unless the property is changed from the property grid itself). You can use the UpdatePropertyGrid method to force the property grid to update itself.
See Also