[DevExpress Support Team: CLONED FROM T577264: How to migrate a WinForms application to use the Light Style]
Hi,
Using th e WinApplication.UseLightStyle property has a breaking change which is not listed.
I have a custom controller which is handling the MasterDetailMode.ListViewAndDetailView mode. the View.Control used to be a DevExpress.XtraEditors.SplitContainerControl and has been changed to a Panel…?
I started to debug but inspecting this object make Visual crash.
Thanks for your prompt help
Hello Maxime,
Would you please attach your current Controller code? I fear that the View.Control related part is not written in accordance with
best practices (e.g., if you try to access the layout control). I look forward to hearing from you to find the best solution.
public partial class MasterDetailViewControllerWin : ViewController<DevExpress.ExpressApp.ListView> { public MasterDetailViewControllerWin() { InitializeComponent(); // Target required Views (via the TargetXXX properties) and create their Actions. } protected override void OnActivated() { base.OnActivated(); //Frame.GetController<NewObjectViewController>().ObjectCreated += MasterDetailViewControllerWin_ObjectCreated; // choose master detail mode based on root or nested view //ew.Model.MasterDetailMode = View.IsRoot ? MasterDetailMode.ListViewAndDetailView : MasterDetailMode.ListViewOnly; // subscribe to layout event to handle best detail width. if (Frame.Template is Form) { //((Form)Frame.Template).Layout += new LayoutEventHandler(ListViewController_Layout); } } void MasterDetailViewControllerWin_ObjectCreated(object sender, ObjectCreatedEventArgs e) { GridListEditor gridListEditor = View.Editor as GridListEditor; if (gridListEditor != null && e.CreatedObject.Equals(gridListEditor.GridView.GetRow(GridControl.NewItemRowHandle))) { View.EditView.CurrentObject = e.CreatedObject; } } void ListViewController_Layout(object sender, LayoutEventArgs e) { if (View.Model.MasterDetailMode == MasterDetailMode.ListViewAndDetailView && View.EditView != null && View.Control is DevExpress.XtraEditors.SplitContainerControl) { var splitContainer = View.Control as DevExpress.ExpressApp.Win.Layout.SplitContainer; splitContainer.Panel2.MinSize = ((LayoutControl)View.EditView.Control).Root.MinSize.Height; } } protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); // Access and customize the target View control. if (View.Model.MasterDetailMode == MasterDetailMode.ListViewAndDetailView && View.Control is DevExpress.XtraEditors.SplitContainerControl) { var splitContainer = View.Control as DevExpress.ExpressApp.Win.Layout.SplitContainer; splitContainer.FixedPanel = SplitFixedPanel.Panel2; } } protected override void OnDeactivated() { base.OnDeactivated(); // Unsubscribe from previously subscribed events and release other references and resources. Frame.GetController<NewObjectViewController>().ObjectCreated -= new EventHandler<ObjectCreatedEventArgs>(MasterDetailViewControllerWin_ObjectCreated); if (Frame.Template is Form) { //((Form)Frame.Template).Layout -= new LayoutEventHandler(ListViewController_Layout); } } }
thanks Dennis