Hide visual element in property grid

1 Answer 112 Views
PropertyGrid
alex
Top achievements
Rank 2
Iron
alex asked on 07 Jun 2023, 06:39 PM

Hi, could you tell me how to remove an item from the propertygrid that is highlighted in red? this appears after editing a field

theme: office2019dark

telerik winforms: r1 2023

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 08 Jun 2023, 02:55 PM

Hello Alex,

Thank you for the provided image.

The three dots will appear when you edit a property value. Clicking the three dots a context menu will appear which allows you to reset to the default value. If you want to hide it you can subscribe to the ItemFormatting event of the RadPropertyGrid control. Inside the event handler, you can hide the three dots button.

private void RadPropertyGrid1_ItemFormatting(object sender, PropertyGridItemFormattingEventArgs e)
{
    PropertyGridItemElement itemElement = e.VisualElement as PropertyGridItemElement;
    if (itemElement != null)
    {
        ((PropertyGridTextElement)itemElement.TextElement).PropertyValueButton.Visibility = ElementVisibility.Collapsed;
    }
}

Keep in mind that the user will still be able to see the context menu when clicking with the mouse's right button. You can disable it by subscribing to the ContextMenuOpening event and cancel it.

private void radPropertyGrid1_ContextMenuOpening(object sender, PropertyGridContextMenuOpeningEventArgs e)
{
    e.Cancel = true;
}

I hope this helps.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

alex
Top achievements
Rank 2
Iron
commented on 08 Jun 2023, 05:21 PM

thanks! thats all i need
Tags
PropertyGrid
Asked by
alex
Top achievements
Rank 2
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or