Back to Devexpress

PGridOptionsView.AllowPaintValue Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-pgridoptionsview.md

latest4.2 KB
Original Source

PGridOptionsView.AllowPaintValue Property

Gets or sets whether to display value representations provided by custom editors (Classic view only).

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
[DefaultValue(false)]
[XtraSerializableProperty]
public bool AllowPaintValue { get; set; }
vb
<DefaultValue(False)>
<XtraSerializableProperty>
Public Property AllowPaintValue As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true, to display a property value representation; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AllowPaintValue
PropertyGridControl

.OptionsView .AllowPaintValue

|

Remarks

You can provide a custom editor for a property using the Editor attibute.

csharp
public class SelectedObject {
    [EditorAttribute(typeof(AngleEditor), typeof(System.Drawing.Design.UITypeEditor))]
    public double Angle { get; set; }
}
vb
Public Class SelectedObject

    Private int_angle As Double

    <EditorAttribute(GetType(AngleEditor), GetType(System.Drawing.Design.UITypeEditor))>
    Public Property Angle() As Double
        Get
            Return int_angle
        End Get
        Set(ByVal value As Double)
            int_angle = value
        End Set
    End Property
End Class

See UITypeEditor on MSDN for more information on how to implement a custom edtior.

The UITypeEditor type exposes the virtual PaintValue and GetPaintValueSupported methods that you can override to support the display of a value’s representation.

csharp
public class AngleEditor : System.Drawing.Design.UITypeEditor {
    // Override to provide a representation of the property's value.
    public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) {
        //...
    }
    // Returns whether painting a representation of the property's value is supported.
    public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) {
        return true;
    }

    //...
}
vb
Public Class AngleEditor
    Inherits System.Drawing.Design.UITypeEditor
    ' Override to provide a representation of the property's value.
    Public Overrides Sub PaintValue(ByVal e As System.Drawing.Design.PaintValueEventArgs)
        '...
    End Sub

    ' Returns whether painting a representation of the property's value is supported.
    Public Overrides Function GetPaintValueSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) A
        Return True
    End Function

    '...
End Class

To enable the property grid to use the provided representation, set the AllowPaintValue property to true.

csharp
propertyGridControl1.OptionsView.AllowPaintValue = true;
vb
PropertyGridControl1.OptionsView.AllowPaintValue = True

See Also

PGridOptionsView Class

PGridOptionsView Members

DevExpress.XtraVerticalGrid Namespace