Unplanned
Last Updated: 30 Apr 2018 11:26 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 03 Apr 2018 06:11
Category: PropertyGrid
Type: Bug Report
1
FIX. RadPropertyGrid - ReadOnlyAttribute is not respected
To reproduce:

    Sub New()

        InitializeComponent()

        Dim intItem As New PropertyStoreItem(GetType(Integer), "Integer", 1)
        Dim floatItem As New PropertyStoreItem(GetType(Single), "Float", 1.0F, "Property storing a floating point value.")
        Dim stringItem As New PropertyStoreItem(GetType(String), "String", "telerik", "Property storing a string value", "Telerik")
        Dim fontItem As New PropertyStoreItem(GetType(Font), "Font", New Font("Arial", 12, FontStyle.Italic), "Property containing Font value")

        fontItem.Attributes.Add(New ReadOnlyAttribute(True))
        floatItem.Attributes.Add(New ReadOnlyAttribute(True))
        Dim store As New RadPropertyStore
        store.Add(intItem)
        store.Add(floatItem)
        store.Add(stringItem)
        store.Add(fontItem)
        Me.RadPropertyGrid1.SelectedObject = store
    End Sub

Try to edit either the "Float" or the "Font" property. The editor will be activated although it doesn't have to.

Workaround: cancel the Editing event

    Private Sub RadPropertyGrid1_Editing(sender As Object, e As PropertyGridItemEditingEventArgs)
        If e.Item.Name = "Font" Then
            e.Cancel = True
        End If 
    End Sub
0 comments