Bug Report T929984
Visible to All Users

WinForms - A focused editor's value is not posted or reset after clicking Save when UseOldTemplates is True

created 4 years ago (modified 4 years ago)

Steps to reproduce

  1. Run the attached project.
  2. Create DomainObject1.
  3. Change the ProductionYear property.
  4. Click Save.

Current behavior
The editor's value is reset.

Current solutions
Use one of the following ways to resolve the issue in the current version:

  1. Set the WinApplication.UseOldTemplates property to False at startup. This property is set to True only in existing projects created before v14.2. The Solution Wizard enables new templates for all XAF WinForms applications created in v14.2 or later. We recommend using new templates when possible. We no longer fix bugs and develop new features for old templates.

OR

  1. Add the following controller to your application:
Visual Basic
Imports System.Windows.Forms Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Win.Core Public Class CommitChangesController Inherits ViewController Public Sub New() TargetViewNesting = Nesting.Root End Sub Protected Overrides Sub OnActivated() MyBase.OnActivated() AddHandler ObjectSpace.Committing, AddressOf ObjectSpace_Committing End Sub Private Sub ObjectSpace_Committing(ByVal sender As Object, ByVal e As EventArgs) BindingHelper.EndCurrentEdit(CType(View.Control, Control)) End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() RemoveHandler ObjectSpace.Committing, AddressOf ObjectSpace_Committing End Sub End Class

If options #1 and 2 do not help you
Make sure that you follow this best practice: PropertyChanged Event in Business Classes. Although you can temporarily restore the previous behavior using DetailView.RaiseObjectChangedOnControlValueChanged, I strongly recommend you fix your data model to follow the best practice - it will save your time and improve application performance in other places in the future. For more information, see Core - The IObjectSpace.ObjectChanged event is not raised in response to the editor's ControlValueChanged event.

IMPORTANT NOTES
To address synchronization issues with such feature toggles in different versions, XAF v20.2 ships with a unified feature selector: Core - FrameworkSettings.DefaultSettingsCompatibilityMode sets default XAF configuration options and feature toggles. I hope you find this helpful.

Answers approved by DevExpress Support

created 4 years ago

We have addressed the issue described in this ticket and will include a fix in our next maintenance update. To apply this solution before official release, request a hotfix by clicking the appropriate version link.

Note: Hotfixes may be unavailable for betas/updates set for release within a week.

Additional information:

This issue aroused as a result of another issue being fixed (WinForms - The Save action in a parent MDI window does not store an editor value when a child form is selected), but it hasn't been noticed because old templates are not tested any longer. We recommend upgrading existing XAF projects to use new Templates by setting the WinApplication.UseOldTemplates property to false in the application's InitializeDefaults method.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.