question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resize grip is missing in PropertyGrid DropDown editor after update to net5.0-windows

See original GitHub issue
  • .NET Core Version: .Net 5 (net5.0-windows)

  • Have you experienced this same bug with .NET Framework?: No

Problem description: I have simple drop-down editor IsDropDownResizable => true and GetEditStyle => UITypeEditorEditStyle.DropDown. For net472 or netcoreapp3.1 there’s resize grip under drop-down editor. After update to net5.0-windows resize grip is missing.

Expected behavior: Resize grip is displayed under editor control.

Minimal repro:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            propertyGrid1.SelectedObject = new Foo(); // propertyGrid1 added via designer
        }
    }
    public sealed class Foo
    {
        [Editor(typeof(FooBarEditor), typeof(UITypeEditor))]
        public string Bar { get; set; }
    }
    public sealed class FooBarEditor : UITypeEditor
    {
        public override bool IsDropDownResizable => true;

        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
            => UITypeEditorEditStyle.DropDown;

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            ((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)))
                .DropDownControl(new Panel { BackColor = Color.Yellow });

            return value;
        }
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
willibrandoncommented, Dec 7, 2020

This issue appears to partially have something to do with the order in which the ResizeGripSize, ResizeBarSize, and ResizeBorderSize are being initialized in PropertyGridView.DropDownHolder.

If I change the order from this:

private readonly static int ResizeBarSize = ResizeGripSize + 1; // the thickness of the resize bar
private readonly static int ResizeBorderSize = ResizeBarSize / 2; // the thickness of the 2-way resize area along the outer edge of the resize bar
private readonly static int ResizeGripSize = SystemInformation.HorizontalScrollBarHeight; // the size of the 4-way resize grip at outermost corner of the resize bar

To this:

private readonly static int ResizeGripSize = SystemInformation.HorizontalScrollBarHeight; // The size of the 4-way resize grip at outermost corner of the resize bar.
private readonly static int ResizeBarSize = ResizeGripSize + 1;// The thickness of the resize bar.
private readonly static int ResizeBorderSize = ResizeBarSize / 2;// The thickness of the 2-way resize area along the outer edge of the resize bar.

The drop down resize bar is now displayed and can resize the drop down, but the resize bar is missing the resize grip.

PropertyGridView1

I’ll try to figure out why the resize bar is missing the resize grip, any insight would be appreciated.

2reactions
kirsan31commented, Nov 24, 2020

@ds1709

I also noticed that size of windows and controls is different in net472 and net5.0.

https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#net-core-30

Read more comments on GitHub >

github_iconTop Results From Across the Web

RadPropertyGrid custom dropdown editor not changing
Hello, I've got a custom editor for some PropertyGrid items that is displaying in the grid values correctly, and the subsequent drop down...
Read more >
Derive PropertyGrid dropdown list from property that is an ...
This interfaces the property to the custom editor. value contains the value passed from the property. It can be of any object type....
Read more >
VCL, ASP.NET, Windows Mobile, .NET controls & ...
DropDownAlwaysVisible = true Update : TAdvRatingGrid v1.4.0.0 ... Improved : Image resizing - Fixed : Issue with Find() function - Fixed : Insert...
Read more >
Release Notes
Added new parameter to the 'update' function of the FirmwareUpdater class. ... (mv.impact.acquire.dll) - Sometimes when an editor in the property grid was ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found