Enum changes not applied when losing focus

8 posts, 0 answers
  1. Sean
    Sean avatar
    10 posts
    Member since:
    Aug 2012

    Posted 18 Apr 2013 Link to this post

    When a property based on an enum is changed, the change is not applied unless you hit ENTER or click elsewhere on the property grid.  This issue can be demonstrated by the PropertyGrid->Setttings demo. Change the “AccessibleName” property and then click on the “UI Settings” groupbox so the property grid loses focus and you can see the property get applied.  Do the same thing with “AccessibleRole” and the change is not applied until you click back on the property grid.
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 23 Apr 2013 Link to this post

    Hello Sean,

    Thank you for writing.

    I was able to reproduce the issue you have described and have logged it in our Public Issue Tracking System - PITS. You can track its progress subscribe for status changes and add your vote comment to it on the following link - PITS Issue. Until the issue is resolved you can workaround it by subscribing to the EditorInitialized event of RadPropertyGrid and in the event handler subscribe to the editor element's RadPropertyChanged. In that event handler you can track whether the property being changed is ContainsFocusProperty and if it is call the property grid EndEdit method. Here is how your code would look like:
    private void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
    {
        PropertyGridDropDownListEditor editor = e.Editor as PropertyGridDropDownListEditor;
     
        if (editor != null)
        {
            BaseDropDownListEditorElement element = editor.EditorElement as BaseDropDownListEditorElement;
            element.RadPropertyChanged += element_RadPropertyChanged;
        }
    }
     
    private void element_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
    {
        if (e.Property == RadElement.ContainsFocusProperty && !(bool)e.NewValue)
        {
            this.radPropertyGrid1.EndEdit();
        }
    }

    I have also updated your Telerik Points for bringing this issue to our attention.

    I hope this will be useful. Should you have further questions, I would be glad to help.

    All the best,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. George
    George avatar
    62 posts
    Member since:
    Sep 2008

    Posted 23 Apr 2013 Link to this post

    Having the same problem for a VB project, unfortunately the #C code is rather hairy to be translated to VB,

    private void element_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
    {
        if (e.Property == RadElement.ContainsFocusProperty && !(bool)e.NewValue)
        {
            this.radPropertyGrid1.EndEdit();
        }
    }

    any friendly suggestions on how to implement this in VB?

    Thanks,
  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 26 Apr 2013 Link to this post

    Hello George,

    Thank you for writing.

    Here is the code you can use for a VB project:
    Private Sub element_RadPropertyChanged(sender As Object, e As RadPropertyChangedEventArgs)
        If e.Property.FullName = RadElement.ContainsFocusProperty.FullName AndAlso Not CBool(e.NewValue) Then
            Me.RadPropertyGrid1.EndEdit()
        End If
    End Sub

    I hope this will help. Do not hesitate to write back with further questions.

    All the best,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  6. George
    George avatar
    62 posts
    Member since:
    Sep 2008

    Posted 26 Apr 2013 Link to this post

    Hi, thanks for feedback

    Although the proposed solution is a work around to the problem, there is a remaining troublesome issue that I want to check if it also happens to others.

    When the user clicks on the dropdown list box to select a new enum option, instead of the currently selected value to be chosen and highlighted, the focus moves to first first available option in the list.

    This is not the normal drop down list behavior and it could be confusing to the end user, since this value is being displayed until you click somewhere else and then the properly selected value is displayed.

    Regards,

    George

  7. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 01 May 2013 Link to this post

    Hello George,

    Thank you for writing.

    I have tested the described behavior both with and without the workaround provided, however, the selected item was correctly selected in the drop down as well. If you continue experiencing this issue, please open a new support ticket with a sample demonstrating the issue and we will be happy to help you with it.
     
    Greetings,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  8. Filipe
    Filipe avatar
    2 posts
    Member since:
    Sep 2013

    Posted 17 Sep 2013 Link to this post

    Hello,

    I have the same problem in my application. The solution has fixed the problem, but I tried to apply that for a BaseSpinEditorElement and the problem is when the user click on the narrow down or up, it loses the focus and the value is not changed. What should I do?

    p.s.: the problem with the dropDownList occurs as well with the BaseSpin.  The change is not applied unless you hit ENTER or click elsewhere on the property grid.
  9. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 20 Sep 2013 Link to this post

    Hi Filipe,

    I can confirm that this problem occurs with the spin editor as well and I have logged it accordingly. Here is a link to the item: http://www.telerik.com/support/pits.aspx#/public/winforms/15799

    You can use the same workaround for this editor as well.

    I have updated your 
    Telerik Points for this report.
     

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready