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