Unplanned
Last Updated: 16 Jul 2020 06:00 by ADMIN

Hello, 

we are trying to use RadPropertyGrid to show the properties of some objects listed in a RadGrdiView. 

We use ExpandableObject to expand our custom property, but we have some problems when we try to show the properties of multiple selected items, when the values of the attribute of the property are not the same in all the selected objects. We tried to use PropertyGrid of Winform and we don't have this problem. 

Thank you.

Unplanned
Last Updated: 14 Mar 2019 18:39 by ADMIN
Workaround:
 Private Sub RadPropertyGrid1_EditorRequired(sender As Object, e As PropertyGridEditorRequiredEventArgs) Handles RadPropertyGrid1.EditorRequired
     Dim te As PropertyGridTableElement = TryCast(sender, PropertyGridTableElement)
     If e.EditorType = GetType(PropertyGridSpinEditor) Then
         Dim editor As New CustomPropertyGridSpinEditor
         If editor IsNot Nothing AndAlso te IsNot Nothing Then
             Dim type As Type = RadPropertyGrid1.SelectedObject.[GetType]().GetProperty(e.Item.Name).PropertyType
             If type = GetType(System.Double) Then
                 DirectCast(editor.EditorElement, BaseSpinEditorElement).DecimalPlaces = 4
                 e.Editor = editor
             End If
         End If
     End If
 End Sub

 Public Class CustomPropertyGridSpinEditor
     Inherits PropertyGridSpinEditor
     Public Overrides Sub Initialize(owner As Object, value As Object)
         Dim decimalPlaces As Integer = Me.DecimalPlaces
         MyBase.Initialize(owner, value)

         Dim element As PropertyGridItemElement = TryCast(owner, PropertyGridItemElement)
         Dim item As PropertyGridItem = TryCast(element.Data, PropertyGridItem)
         Dim editedType As Type = item.PropertyType

        If ((editedType = GetType(Decimal) OrElse editedType = GetType(Double) OrElse editedType = GetType(Single)) AndAlso decimalPlaces <> 0) Then
         DirectCast(Me.EditorElement, BaseSpinEditorElement).DecimalPlaces = decimalPlaces
         Me.Value = value
       End If
     End Sub
 End Class
Unplanned
Last Updated: 21 May 2018 11:36 by ADMIN
The incorrect behavior is also observed if the SelectedObject is changed.

How to reproduce:

public partial class RadForm1 : RadForm
{
    public RadForm1()
    {
        this.InitializeComponent();
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        this.radPropertyGrid1.EnableSorting = true;
        this.radPropertyGrid1.SelectedObject = new TestObject();
        foreach (var item in this.radPropertyGrid1.Items)
        {
            if (item.Name == "A")
            {
                item.SortOrder = 2;
            }
            else if (item.Name == "B")
            {
                item.SortOrder = 1;
            }
            else
            {
                item.SortOrder = 0;
            }
        }

        this.radPropertyGrid1.PropertySort = PropertySort.NoSort;
    }
}

public class TestObject
{
    public int A { get; set; }
    public int C { get; set; }
    public int B { get; set; }
}

Workaround:
1. Use attributes in the model class:
public class TestObject
{
    [RadSortOrder(2)]
    public int A { get; set; }
    [RadSortOrder(0)]
    public int C { get; set; }
    [RadSortOrder(1)]
    public int B { get; set; }
}

2. Alternatively, toggle the PropertySort property in the Shown event of the form:
public partial class RadForm1 : RadForm
{
    public RadForm1()
    {
        this.InitializeComponent();
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        this.radPropertyGrid1.EnableSorting = true;
        this.radPropertyGrid1.SelectedObject = new TestObject();
        foreach (var item in this.radPropertyGrid1.Items)
        {
            if (item.Name == "A")
            {
                item.SortOrder = 2;
            }
            else if (item.Name == "B")
            {
                item.SortOrder = 1;
            }
            else
            {
                item.SortOrder = 0;
            }
        }

        this.radPropertyGrid1.PropertySort = PropertySort.NoSort;
    }

    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);

        this.radPropertyGrid1.PropertySort = PropertySort.Alphabetical;
        this.radPropertyGrid1.PropertySort = PropertySort.NoSort;
    }
}

public class TestObject
{
    public int A { get; set; }
    public int C { get; set; }
    public int B { get; set; }
}
Unplanned
Last Updated: 30 Apr 2018 11:26 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Sr.
Comments: 0
Category: PropertyGrid
Type: Bug Report
1
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
Unplanned
Last Updated: 20 Mar 2018 08:26 by ADMIN
ADMIN
Created by: Dimitar
Comments: 0
Category: PropertyGrid
Type: Bug Report
1
Use attached to reproduce.
- Type 'n' in the search bar 
- "Name" is not found

Unplanned
Last Updated: 19 Jan 2018 13:24 by ADMIN
How to reproduce: run the attached project on a system with an increased scaling - 200%
Unplanned
Last Updated: 04 Oct 2016 08:00 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent();

    this.radPropertyGrid1.SelectedObject = new Item(123,"Item123",DateTime.Now.AddDays(20));
    this.radPropertyGrid1.EditorInitialized += radPropertyGrid1_EditorInitialized;
}

private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
    PropertyGridDateTimeEditor propertyGridDateTimeEditor = e.Editor as PropertyGridDateTimeEditor;
    if (propertyGridDateTimeEditor != null)
    {              
        BaseDateTimeEditorElement dateTimeEditorElement = propertyGridDateTimeEditor.EditorElement as BaseDateTimeEditorElement;
        if (dateTimeEditorElement != null)
        {
            dateTimeEditorElement.Format = DateTimePickerFormat.Long;
    
            dateTimeEditorElement.ShowTimePicker = true;
            var radDateTimePickerCalendar = dateTimeEditorElement.CurrentBehavior as RadDateTimePickerCalendar;
            if (radDateTimePickerCalendar != null)
            { 
                radDateTimePickerCalendar.DropDownMinSize = new System.Drawing.Size(600, 400);
            }
        }
    }
} 

public class Item
{
    public int Id { get; set; }

    public string Name { get; set; }

    public DateTime Date { get; set; }

    public Item(int id, string name, DateTime date)
    {
        this.Id = id;
        this.Name = name;
        this.Date = date;
    }
}

Workaround:

private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
    PropertyGridDateTimeEditor propertyGridDateTimeEditor = e.Editor as PropertyGridDateTimeEditor;
    if (propertyGridDateTimeEditor != null)
    {              
        BaseDateTimeEditorElement dateTimeEditorElement = propertyGridDateTimeEditor.EditorElement as BaseDateTimeEditorElement;
        if (dateTimeEditorElement != null)
        {
            dateTimeEditorElement.Format = DateTimePickerFormat.Long;
    
            dateTimeEditorElement.ShowTimePicker = true;
            var radDateTimePickerCalendar = dateTimeEditorElement.CurrentBehavior as RadDateTimePickerCalendar;
            if (radDateTimePickerCalendar != null)
            {
                radDateTimePickerCalendar.PopupControl.PopupOpened-=PopupControl_PopupOpened;
                radDateTimePickerCalendar.PopupControl.PopupOpened+=PopupControl_PopupOpened;
            }
        }
    }
}

private void PopupControl_PopupOpened(object sender, EventArgs args)
{
    RadDateTimePickerDropDown dropdown = sender as RadDateTimePickerDropDown;
    dropdown.MinimumSize = new Size(600, 300);
}
Unplanned
Last Updated: 27 Jun 2016 12:12 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Sr.
Comments: 0
Category: PropertyGrid
Type: Bug Report
1

					
			
Unplanned
Last Updated: 30 Mar 2016 10:45 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent();
    this.radPropertyGrid1.SelectedObject = this;

    this.radPropertyGrid1.ContextMenuOpening += radPropertyGrid1_ContextMenuOpening;
}

private void radPropertyGrid1_ContextMenuOpening(object sender, Telerik.WinControls.UI.PropertyGridContextMenuOpeningEventArgs e)
{
    foreach (RadItem item in e.Menu.Items)
    {
        if (item.Text == "Sort")
        {
            item.Visibility = ElementVisibility.Collapsed;
            item.PropertyChanged += item_PropertyChanged;
        }
    }
}

Workaround:
private void radPropertyGrid1_ContextMenuOpening(object sender, Telerik.WinControls.UI.PropertyGridContextMenuOpeningEventArgs e)
{
    RadItem item = null;
    for (int i = 0; i < e.Menu.Items.Count; i++)
    {
        item = e.Menu.Items[i];
        if (item.Text=="Sort")
        {
            e.Menu.Items.Remove(item);
        }
    } 
}
Unplanned
Last Updated: 30 Mar 2016 10:09 by ADMIN
To reproduce: Use the following code snippet and perform the step illustrating on the attached gif file. Note that this undesired behavior appears randomly.
Partial Public Class Form1
Inherits Telerik.WinControls.UI.RadForm

    Public Sub New()
        InitializeComponent()
        radPropertyGrid1.PropertySort = Windows.Forms.PropertySort.Categorized
        radPropertyGrid1.SortOrder = Windows.Forms.SortOrder.None
         
        Dim metaDocItem As New PropertyStoreItem(GetType(String), "Document ID", "16.0", "Document ID Number", "Meta Data", True)
        Dim fileInfoItem As New PropertyStoreItem(GetType(FileInfo), "File Info", New FileInfo("sample file path", "file name path"), _
                                                  "", "Meta Data", True)
        fileInfoItem.Attributes.Add(New TypeConverterAttribute(GetType(MyDataConverter)))
        Dim stringItem As New PropertyStoreItem(GetType(String), "String", "telerik", "Property storing a string value", "Meta Data", True)
        Dim dockItem As New PropertyStoreItem(GetType(DockStyle), "Dock", DockStyle.Top, "Property containing DockStyle value", "Meta Data", True)

        Dim store As New RadPropertyStore
        store.Add(metaDocItem)
        store.Add(fileInfoItem)
        store.Add(stringItem)
        store.Add(dockItem)
        Me.RadPropertyGrid1.SelectedObject = store
    End Sub
End Class
 
Public Class FileInfo
    Private _filePath As String
    Private _fileName As String

    Public Sub New(filePath As String, fileName As String)
        Me._filePath = filePath
        Me._fileName = fileName
    End Sub

    Public ReadOnly Property FilePath() As String
        Get
            Return _filePath
        End Get
    End Property

    Public ReadOnly Property FileName() As String
        Get
            Return _fileName
        End Get
    End Property
End Class

Public Class MyDataConverter
Inherits ExpandableObjectConverter
    Public Overrides Function CanConvertTo(context As ITypeDescriptorContext, destinationType As Type) As Boolean
        If destinationType = GetType(String) Then
            Return True
        End If
        Return MyBase.CanConvertTo(context, destinationType)
    End Function
    Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As System.Globalization.CultureInfo, _
                                        value As Object, destinationType As Type) As Object
        If destinationType <> GetType(String) Then
            Return MyBase.ConvertTo(context, culture, value, destinationType)
        End If
        Return String.Empty
    End Function 
End Class

Workaround: add a RadSortOrderAttribute to each PropertyStoreItem and leave the default  SortOrder = Windows.Forms.SortOrder.Ascending
Unplanned
Last Updated: 30 Mar 2016 10:06 by ADMIN
To reproduce:
Open VisualStyleBuilder and navigate to RadGanttView -> RadGanttViewElement and try to edit the Value of the BackgroundImageLayout and ImageLayout properties.


Workaround:
Edit the value manually, as a string