WinPropertyEditor Class
Represents a base class for Windows Forms Property Editors.
Namespace: DevExpress.ExpressApp.Win.Editors
Assembly: DevExpress.ExpressApp.Win.v24.2.dll
NuGet Packages: DevExpress.ExpressApp.Win, DevExpress.ExpressApp.Win.Design
#Declaration
public abstract class WinPropertyEditor :
PropertyEditor,
ISupportToolTip
#Remarks
Inherit from this class, to implement a custom Windows Forms Property Editor using a standard control that supports binding. If the control does not support binding, inherit from the PropertyEditor class. To implement a custom Property Editor based on a control derived from BaseEdit, inherit from the DXPropertyEditor class.
Compared to the PropertyEditor class, the WinPropertyEditor class introduces additional members:
Member | Description |
---|---|
Win |
Provides access to the control that represents the current Property Editor in a UI. |
Win |
Specifies the control’s property that is used for data binding. |
Win |
Returns the default control height in pixels. Used by the XAF built-in Property Editors. |
The simplest implementation of the WinPropertyEditor class’ descendant requires the following:
- Override the CreateControlCore method. Create and return an instance of the required control in this method.
- Determine which event of the control occurs when the editing value is changed by a user (refer to the control’s documentation to find the appropriate event). Subscribe to this event and call the OnControlValueChanged method from the event handler.
- Specify the WinPropertyEditor.ControlBindingProperty value in the constructor or in the CreateControlCore method.
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.Win.Editors;
// ...
[PropertyEditor(typeof(int), false)]
public class MyPropertyEditor : WinPropertyEditor {
public MyPropertyEditor(Type objectType, IModelMemberViewItem model) : base(objectType, model) { }
protected override object CreateControlCore() {
System.Windows.Forms.TrackBar trackbarControl = new System.Windows.Forms.TrackBar();
trackbarControl.Minimum = 0;
trackbarControl.Maximum = 100;
trackbarControl.Scroll += trackbarControl_Scroll;
this.ControlBindingProperty = "Value";
return trackbarControl;
}
void trackbarControl_Scroll(object sender, EventArgs e) {
this.OnControlValueChanged();
}
}
Tip
Set the Can