Quantcast
Channel: Developer Express Inc.
Viewing all articles
Browse latest Browse all 2370

WinForms Property Grid - New Office View (v18.1)

$
0
0

The DevExpress Property Grid is an object inspector that displays properties of one or several assigned objects, and allows end-users to modify these properties at runtime. In this image, a Property Grid is attached to the Diagram Control so that users can customize shapes parameters:

Property Grid

Property tabs

Traditionally, the control arranges all public properties in a single tree structure, retrieving the entire hierarchy of properties from the inspected object(s). In our upcoming v18.1 release, we will introduce a feature that allows you to customize the default layout by organizing all properties into convenient tabs, as seen in the UI of the latest Office applications.

Setting up the tabs is easy. Switch the ActiveViewType property to Office, then go to the Tabs page of the control designer. Create one or more tabs and check all those properties in the list that you would like to include on each tab. At runtime, the Property Grid sorts the object properties according to your tab definition.

Property Grid Tabs

Secondary editor for numeric values

The image above reveals a second v18.1 Property Grid feature: the Size property shows two editors simultaneously, a track bar and a SpinEdit. For numeric properties, this makes it easy for the user to adjust values by large margins, but also to be very precise when required. Handle the CustomRowCreated event to enable this additional track bar.

private void PropertyGridControl1_CustomRowCreated(object sender, DevExpress.XtraVerticalGrid.Events.CustomRowCreatedEventArgs e) {
  if (e.Row.Properties.FieldName == "Size") {
    var row = e.Row as PGridNumericEditorRow;
    row.MinValue = 8;
    row.MaxValue = 72;
    row.ShowTrackBar = true;
    row.IgnoreMinMaxForSpinEdit = true;
  }
}

Try it!

The beta release of v18.1 is available to active Universal subscribers now. Please give the new features a try, and get back to us with any feedback!


Viewing all articles
Browse latest Browse all 2370

Trending Articles