Ticket T1280025
Visible to All Users

How to create new object in existing XAF DetailView

created 2 days ago (modified 2 days ago)

Hello,

I have a XAF ViewController that handles a specific DashboardView, containing multiple ListViews and DetailViews.
The displayed object in the DetailView should change based on which object was selected in the corresponding ListView.
When no objects are available in the corresponding ListView and thus no object is selected, I want to clear the corresponding DetailView, so I can directly create a new object within that DetailView.

I have tried many things like setting _myObjectDetailView.CurrentObject = null or _myObjectDetailView.CurrentObject = new MyObject(session), or by using _myObjectDetailView = Application.CreateDetailView(_myObjectDetailView.ObjectSpace, _myObjectDetailView.ObjectSpace.CreateObject<MyObject>()), but non of it worked, the DetailView is always grayed out.

In my EventHandler where I handle the SelectionChanged Event of the ListView, I have access to both of the corresponding ListView and DetailView:

C#
public class MyObjectsController : ViewController<DashboardView> { private ListView _myObjectListView = null!; // Set in OnActivated, so never null. private DetailView _myObjectDetailView = null!; // Set in OnActivated, so never null. private void MyObjectListViewSelectionChanged(object? sender, EventArgs e) { // Clear _myObjectDetailView here and allow the creation of a new object (MyObject) within that DetailView. } }

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.