This example demonstrates how to prevent a user from invoking a Detail View of an object in a List View.
To allow users to edit objects directly in a List View, enable the in-place edit and split layout functionality.
Implementation Details
Call the Frame.GetController method to access an instance of the ListViewProcessCurrentObjectController class and disable the ListViewProcessCurrentObjectController.ProcessCurrentObjectAction property.
Additional Information
This example applies only when an XAF application displays a Detail View of an object after a user double-clicks this object in a List View, or focuses an object in a List View and presses Enter. To handle other scenarios, extend the controller's code. For example, if you do not want your XAF application to invoke a Detail View after a user clicks the New button to create an object in a List View, handle the NewObjectViewController.ObjectCreating event and set the ObjectCreatingEventArgs.ShowDetailView property to false
.
Files to Review
Documentation
- Core - Make it easier to prevent showing a DetaiView from a ListView permanently or on a condition
- List View Edit Modes
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;
namespace dxTestSolution.Module.Controllers {
public class DisableShowingViewController : ViewController {
protected override void OnActivated() {
base.OnActivated();
ListViewProcessCurrentObjectController targetController = Frame.GetController<ListViewProcessCurrentObjectController>();
if (targetController != null) {
targetController.ProcessCurrentObjectAction.Enabled["MyReason"] = false;
}
}
}
}