I am failry new to telerik and WPF and MVVM, so please forgive my lack on knowledge, I have a Shell that that uses directory searching to find modules that I can load into its regions, Each module has a few views that are have top level elementa radSplitContainer, A few of those views can be opened at one time and each has custom logic when the RapPane is closed
What I did was used event aggregation to publish the closed event, but I cant find a way to know what view called the close event without creating a reference to my view inside my viewmodell. I have tried
private void DockMain_PreviewClose(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)<br> {<br> if (e.Panes != null && e.Panes.Count() > 0 && e.Panes.ToList()[0].GetType() == typeof(RadPane))<br> {<br> if (_mainviewmodel != null)<br> {<br> var test = e.Panes.ToList()[0].ParentOfType<RadSplitContainer>();<br> var bol = test.GetType().IsAssignableFrom(typeof(IModuleView));<br> //var test = e.Panes.ToList()[0].ParentOfType<RadSplitContainer>();<br> _mainviewmodel.OnPreviewClose(e.Panes.ToList()[0].ParentOfType<RadSplitContainer>() as IModuleView);//publish teh subscriber event<br> }<br> }<br> }
to try and create an interface that both the view and viewModel would implement, but i can never find an object that supports the interface I just created or anyway I can tap into the close event from the view instead of from the RapDock control.