DropDownList GotFocus Event Not Working

5 posts, 1 answers
  1. Muhammad
    Muhammad avatar
    10 posts
    Member since:
    Jun 2013

    Posted 26 Oct Link to this post

    DropDownList GotFocus Event is not being fired. When I Change the property DropDownStyle to DropDownList then it is being fired.

    The Scenario is I have a form, in it's load event i am binding the events which are lying on some other file with different fields. Events are GotFocus and Lost Focus  to behave identically when control got focus or lost focus, i made a common event handler and bind that handle with all fields on form load time. all fields are working well but DropDownList control works only when i change its DropDownStyle property to DropDownList. 

     I dont know why its behaving like this did i miss something ??

  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 27 Oct Link to this post

    Hello,

    Thank you for writing.

    I was not able to reproduce the observed behavior on my end. For convenience, I prepared a small sample, based on the information that you provided so far and attached it to this thread. Could you please check it and let me know what I need to change in order to reproduce this? 

    Thank you in advance for your patience and cooperation. 

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Muhammad
    Muhammad avatar
    10 posts
    Member since:
    Jun 2013

    Posted 27 Oct Link to this post

    I make the necessary changes 

    kindly rename the file from 1070932.jpg to 1070932.jpg and extract the files in to your project folder 

    kindly see the CommonEventHandler Class

    Kindly Change the property DropDownStyle of DropDownList From DropDown to DropDownList and vise versa and see the behavior.

    Regards

     

  5. Muhammad
    Muhammad avatar
    10 posts
    Member since:
    Jun 2013

    Posted 27 Oct in reply to Muhammad Link to this post

    convert into .rar mistakenly i wrote 1070932.jpg 
  6. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 28 Oct Link to this post

    Hi Muhammad,

    When the DropDownStyle is set to DropDown the DropDownList is hosting a TextBox inside it. And in this case, the TextBox is gaining the focus. So when the TextBox gains the focus the BackColor of the DropDownList s reset. I have attached an updated version of the CommonEventHandler which shows how you can handle this.

    I hope this will be useful. 

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready