Unplanned
Last Updated: 24 Feb 2023 14:30 by ADMIN
Piotr
Created on: 24 Feb 2023 14:27
Category: DropDownList
Type: Bug Report
2
RadDropDownList: Control is focused when moving the form between monitors with different DPI scaling

RadDropDownList gets focused when the DpiScaleChanged is triggered.

Run the attached sample project. When the form is moved from monitor A (100% DPI) to monitor B (150% DPI), every RadDropDownList gets the focus which leads to scrolling the container back to the top.

Attached Files:
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 24 Feb 2023 14:30

Hello, Piotr,

Thank you for bringing this case to our attention. We will do our best to address it accordingly. Meanwhile, feel free to use the approach you have already found out for skipping the focus:

    public sealed class XRadDropDownList : RadDropDownList
    {
        public XRadDropDownList()
        {
            DropDownStyle             = RadDropDownStyle.DropDownList;
            ListElement.AutoSizeItems = true;
        }

        protected override RadDropDownListElement CreateDropDownListElement()
        {
            return new XRadDropDownListElement();
        }

        public override string ThemeClassName => typeof(RadDropDownList).FullName;
        
        private sealed class XRadDropDownListElement : RadDropDownListElement
        {
            public override void DpiScaleChanged(SizeF scaleFactor)
            {
                _skipFocusFlag = true;
                base.DpiScaleChanged(scaleFactor);
                _skipFocusFlag = false;
            }

            public override bool Focus()
            {
                if (_skipFocusFlag)
                    return false;
                return base.Focus();
            }

            #region Properties

            protected override Type ThemeEffectiveType => typeof(RadDropDownListElement);

            #endregion

            #region Fields

            private bool _skipFocusFlag;

            #endregion
        }
    }

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
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.