This is a migrated thread and some comments may be shown as answers.

Display a description value in propertygriditem

3 Answers 105 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Maurice
Top achievements
Rank 1
Maurice asked on 30 Jan 2019, 03:35 PM

I have the following

class LookupItem

{

     public Guid Id {get;set;}

     public string Description {get;set;}

}

class SomeOtherClass

{

  public int Key {get;set;}

  public Guid LookupItemId {get;set;}

  public string SomeProperty {get;set;}

}

 

Now.

The LookupItem class will be a part of a collection (or lookup list) e.g. List<LookupItem>

The SomeOtherClass is the selectedObject of the propertygrid

I have looked through the samples such as https://docs.telerik.com/devtools/winforms/knowledge-base/propertygrid-dropdown-editor

and whilst I can get the combobox or RadMultiColumnComboBox to display when editing, I need to be able to show the description value of the selected lookupitem in the propertygrid item. Currently its displaying the LookupItem.Id which is a Guid.

 

Any ideas? The simplest will suffice

3 Answers, 1 is accepted

Sort by
0
Maurice
Top achievements
Rank 1
answered on 31 Jan 2019, 04:00 PM
Heres the effect Im looking for
0
Maurice
Top achievements
Rank 1
answered on 31 Jan 2019, 04:04 PM

Im looking to get a lookuplist that has 2 or more columns working in the property grid.

Thank you.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Feb 2019, 02:51 PM
Hello, Maurice,       

The easiest solution that I can suggest is to handle the ItemFormatting and change the text for the value element:
 
private void radPropertyGrid1_ItemFormatting(object sender, Telerik.WinControls.UI.PropertyGridItemFormattingEventArgs e)
{
    if (e.Item.Label == "property name")
    {
        PropertyGridItemElement itemElement = e.VisualElement as PropertyGridItemElement;
        if (itemElement != null)
        {
            itemElement.ValueElement.Text = "desired text to display";
        }
    }
}

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PropertyGrid
Asked by
Maurice
Top achievements
Rank 1
Answers by
Maurice
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or