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

User alternative ExpandImage an BackColors

1 Answer 56 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Gøran
Top achievements
Rank 2
Gøran asked on 13 May 2014, 05:09 PM
Hi Telerik Team,

I tried to switch the expandImage of the radPropertyGrid for several hours now. Hopefully you can help me to switch the Image ( see attachment -> red box ). In addition to this... how do I switch the backcolor of the sourrounding bars ( see attachment -> yellow boxes ).

I'm setting the content of the radPropertyGrid during runtime using the SelectedObject Property.

Thank you in advance :)

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 May 2014, 10:37 AM
Hello Gøran,

Thank you for writing.

It is appropriate to use the ItemFormatting event in order to customize the described elements:
public Form1()
{
    InitializeComponent();
 
    this.radPropertyGrid1.SelectedObject = this;
    this.radPropertyGrid1.ToolbarVisible = true;
    this.radPropertyGrid1.ItemFormatting+=radPropertyGrid1_ItemFormatting;
}
 
private void radPropertyGrid1_ItemFormatting(object sender, PropertyGridItemFormattingEventArgs e)
{
    PropertyGridGroupElement groupElement = e.VisualElement as PropertyGridGroupElement;
    PropertyGridItemElement itemElement = e.VisualElement as PropertyGridItemElement;
 
    if (groupElement!=null)
    {
        groupElement.ExpanderElement.ExpanderItem.Image = Properties.Resources.arrow;
        groupElement.ExpanderElement.ExpanderItem.ImageLayout = ImageLayout.Zoom;
        groupElement.TextElement.BackColor = Color.Red;
        groupElement.TextElement.DrawFill = true;
        groupElement.TextElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    }
    else if (itemElement!=null)
    {
        itemElement.ExpanderElement.BackColor = Color.LightBlue;
    }           
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PropertyGrid
Asked by
Gøran
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or