Reputation: 3982
How to activate an existing View in Catel? IUIVisualizerService.Show()
always create a new View. I am currently using the following code in ViewModel, which is not nice since it is dependent on Window.
private void ShowSomethingExecute() {
var uiVisualizerService = this.GetDependencyResolver().Resolve<IUIVisualizerService>();
var viewManager = this.GetServiceLocator().ResolveType<IViewManager>();
var testView = viewManager.GetFirstOrDefaultInstance(typeof(TestView));
if (testView == null) {
uiVisualizerService.Show(new TestViewModel());
} else {
(testView as Window)?.Activate();
}
}
Upvotes: 0
Views: 171
Reputation: 5724
There is no way to re-activate a window in the current version. But the good news is that everything is pluggable / replaceable in Catel so you can easily provide your own version that supports this feature.
Or you could create a PR and support this in Catel as well ;-)
Upvotes: 1