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.
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?
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.