Hello,
You can override the OpenObject method of the DevExpress.ExpressApp.Win.SystemModule.OpenObjectController class. Please refer to its source code for more details.
Let us know if we can assist you further.
-
I found this article http://www.devexpress.com/Support/Center/p/Q103790.aspx and change source code which I found in the article to this:
public partial class OpenObjectFrom_VController : DevExpress.ExpressApp.Win.SystemModule.OpenObjectController
{
public OpenObjectFrom_VController()
{
InitializeComponent();
RegisterActions(components);
}protected override void OpenObject(SimpleActionExecuteEventArgs e)
{
object obj = ReflectionHelper.GetMemberValue(e.CurrentObject, "LicensedDealer");
if (View.Id == "Assurance_DetailView" && obj is DealerMLM)
{
ObjectSpace OS = (ObjectSpace)Application.CreateObjectSpace();e.ShowViewParameters.CreatedView = Application.CreateDetailView(OS, "Person_DetailView", false, OS.GetObject(((DealerMLM)obj).GetPerson));
DevExpress.ExpressApp.Win.Core.BindingHelper.EndCurrentEdit(System.Windows.Forms.Form.ActiveForm);
}
else
{
base.OpenObject(e);
}
}
}This is nice: object obj = ReflectionHelper.GetMemberValue(e.CurrentObject, "LicensedDealer"); but in my case I need modify action of many Controls of detailview, not only "LicensedDealer". All Controls are based on DealerMLM and have different names.
Is possible to get object of property which is clicked by user?
I found this article http://www.devexpress.com/Support/Center/p/Q103790.aspx and change source code which I found in the article to this:
[C#]DevExpress.ExpressApp.Win.SystemModule.OpenObjectController { public OpenObjectFrom_VController() { InitializeComponent(); RegisterActions(components); } protected override void OpenObject(SimpleActionExecuteEventArgs e) { object obj = ReflectionHelper.GetMemberValue(e.CurrentObject, "LicensedDealer"); if (View.Id == "Assurance_DetailView" && obj is DealerMLM) { ObjectSpace OS = (ObjectSpace)Application.CreateObjectSpace(); e.ShowViewParameters.CreatedView = Application.CreateDetailView(OS, "Person_DetailView", false, OS.GetObject(((DealerMLM)obj).GetPerson)); DevExpress.ExpressApp.Win.Core.BindingHelper.EndCurrentEdit(System.Windows.Forms.Form.ActiveForm); } else { base.OpenObject(e); } } }
This is nice: object obj = ReflectionHelper.GetMemberValue(e.CurrentObject, "LicensedDealer"); but in my case I need modify action of many Controls of detailview, not only "LicensedDealer". All Controls are based on DealerMLM and have different names.
Is possible to get object of property which is clicked by user?
-
Yes, it is possible.
Please see how the methods below are implemented and used in the OpenObjectController.cs file:
private Object FindObjectToOpen(int mouseX, int mouseY)
private Object FindObjectToOpen(GridColumn column, int rowHandle)
I hope you find this information helpful. -
My final solution is in attachment file.
-
Thank you for posting your final code here. It will be helpful for other Support Center users.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.