Ticket S170665
Visible to All Users

How to skip opening a new window for a created object when MasterDetaiMode = ListViewAndDetailView for a root ListView

created 12 years ago (modified 8 years ago)

Currently, you can use the following solution that is intended for root ListViews:

C#
using System; using System.Linq; using DevExpress.ExpressApp; using System.Collections.Generic; using DevExpress.ExpressApp.SystemModule; namespace MainDemo.Module.Controllers { public class Q484182 : ViewController<ListView> { private NewObjectViewController newController; public Q484182() { TargetViewNesting = Nesting.Root; } protected override void OnActivated() { base.OnActivated(); newController = Frame.GetController<NewObjectViewController>(); newController.ObjectCreating += Q484182_ObjectCreating; Frame.GetController<ModificationsController>().ModificationsCheckingMode = ModificationsCheckingMode.OnCloseOnly; } private void Q484182_ObjectCreating(object sender, ObjectCreatingEventArgs e) { e.ShowDetailView = false; object newObject = View.ObjectSpace.CreateObject(e.ObjectType); View.CollectionSource.Add(newObject); View.CurrentObject = newObject; } protected override void OnDeactivated() { newController.ObjectCreating -= Q484182_ObjectCreating; newController = null; base.OnDeactivated(); } } }

I have not tested this particular solution under all scenarios supported by XAF, so please use it at your own risk, and feel free to modify and test it further to better meet your business requirements.

See Also:
How do I open a separate DetailView from a nested ListView with MasterDetailMode set to ListViewAndDetailView?

Comments (2)

    Hello Dennis,
    I've been looking for this for hours now and the row is actually created, YES!
    I try to save but my validation process tells me some field are required… correct, but when I want to use the lookup editor associated with this property, there is no way to actually select a value.
    Any idea?

    Anatol (DevExpress) 10 years ago

      Hello Maxime,

      To process your post more efficiently, I created a separate ticket on your behalf: T282663: Cannot select a value in a lookup editor when validation fails after applying the solution from the S170665 ticket. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

      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.