This is a migrated thread and some comments may be shown as answers.

Enum changes not applied when losing focus

7 Answers 99 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 19 Apr 2013, 12:25 AM
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.

7 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 23 Apr 2013, 12:28 PM
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.
0
George
Top achievements
Rank 1
answered on 23 Apr 2013, 04:05 PM
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,
0
Ivan Petrov
Telerik team
answered on 26 Apr 2013, 03:18 PM
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.
0
George
Top achievements
Rank 1
answered on 26 Apr 2013, 04:08 PM
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

0
Stefan
Telerik team
answered on 01 May 2013, 02:29 PM
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.
0
Filipe
Top achievements
Rank 1
answered on 17 Sep 2013, 07:44 PM
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.
0
Stefan
Telerik team
answered on 20 Sep 2013, 11:52 AM
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 >>
Tags
PropertyGrid
Asked by
Sean
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
George
Top achievements
Rank 1
Stefan
Telerik team
Filipe
Top achievements
Rank 1
Share this question
or