OnLostFocus virtual method

7 posts, 0 answers
  1. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 07 May 2015 Link to this post

    Hello,

    1. When the Combobox receives the focus with a table, nothing appears with the OnLostFocus method and the LostFocus event.
    Correct.

    2. When the ComboBox is clicked with the mouse the OnLostFocus method is called and then the LostFocus event is raised.
    Error: these should not be called.

    3. When the ComboBox loses the focus, the LostFocus event is raised, but the OnLostFocus method is not called.
    Error: the OnLostFocus method should be called.

    Normally, this OnLostFocus method should fire the LostFocus event. It seems to be bypassed in position 3.

  2. Geri
    Admin
    Geri avatar
    60 posts

    Posted 11 May 2015 Link to this post

    Hi Patrick,

    Thank you for bringing this to our attention.

    We have reproduced the issue and it is now logged in our system - you can follow its progress here.

    We're not sure what is your scenario, but if you're using RadComboBox in non-editable mode, as a workaround we would suggest you to try editing the "NonEditableTemplate" template of RadComboBox - "PART_DropDownButton" should have the Focusable property set to False. 

    Please note the feedback item concerns RadComboBox in a non-editable mode only. For the Editable mode, however, we need to investigate further and can't suggest a workaround at this time.

    We're sorry for any inconvenience this may be causing. We have added Telerik points to your account for the report.

    Regards,
    Geri
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 11 May 2015 in reply to Geri Link to this post

    Hi Geri,

    this is an editable ComboBox. Currently, I have replaced the use of the virtual method by the event. I will change again when the bug is corrected.

  5. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 11 May 2015 in reply to Geri Link to this post

    Hi Geri,

    I've look at the issue in your system. it talks about entry 2 in my original post.

    What about entry 3 (the virtual method not being called)?

  6. Geri
    Admin
    Geri avatar
    60 posts

    Posted 12 May 2015 Link to this post

    Hello Patrick,

    We apologize for missing entry 3 of your questions.

    After further investigating the scenario, we're still unsure that we understand you correctly.
    From what we understand, the event handler of the LostFocus event is not being called when the event is raised. In all of our test, this event handler is always called. The LostFocus event is inherited from the framework and there is no virtual method in the source code of the RadComboBox related to it that could be overridden. It would be of great help if you could tell more details about your scenario - for example is the RadComboBox control inherited.

    Attached we send you a sample project where we demonstrate a workaround for editable RadComboBox - a check whether the focus is in the current UI element. Please take a look and tell us if it works for you. It would be great if you could modify it according to your scenario, and send it back so we can investigate entry 3 from your original post on our side. 

    Also, we plan fixing the issue for both editable and non-editable RadComboBox in some of our upcoming internal builds - please refer to the updated feedback item

    Looking forward to your reply.

    Regards,
    Geri
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  7. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 12 May 2015 in reply to Geri Link to this post

    Hi Gero,

    yes, I'm inheriting the RadComboBox control and have overriden the OnLostFocus protected virtual method to be notified of the control losing focus,

    As said previously, I'm currently using the LostFocus event, because the OnLostFocus virtual method is not called in this case.

  8. Geri
    Admin
    Geri avatar
    60 posts

    Posted 14 May 2015 Link to this post

    Hi Patrick,

    We have investigated the issue and it is now logged in our system - please refer to the feedback item for updates.

    As a workaround, we would suggest attaching the event handlers in the constructor of your control in a fashion, similar to the one below:

    public class MyRadComboBox : RadComboBox
    {
        public MyRadComboBox()
        {
            this.GotFocus += MyRadComboBox_GotFocus;
            this.LostFocus += MyRadComboBox_LostFocus;
        }
     
        void MyRadComboBox_LostFocus(object sender, System.Windows.RoutedEventArgs e)
        {
                 
        }
     
        void MyRadComboBox_GotFocus(object sender, System.Windows.RoutedEventArgs e)
        {
                 
        }
    }

    Please try this out and tell us whether it works for you.

    We're sorry for the caused inconvenience. As a gratitude for your involvement, we have updated your Telerik points. 

    Regards,
    Geri
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready