Get reference to the current instance of Shell window
I am trying to show Modal Dialog and I need reference to the current Shell
window:
public class OpenPopupWindowAction : TriggerAction<FrameworkElement>
{
protected override void Invoke(object parameter)
{
var popup = new ChildWindow();
//(ChildWindow)ServiceLocator.Current.GetInstance<IPopupDialogWindow>();
popup.Owner = PlacementTarget ??
(Window)ServiceLocator.Current.GetInstance<IShell>();
I'm getting:
Cannot set Owner property to a Window that has not been shown previously.
This is the code from Bootstrapper
public class Bootstrapper : UnityBootstrapper
{
protected override System.Windows.DependencyObject CreateShell()
{
Container.RegisterInstance<IShell>(new Shell());
return Container.Resolve<Shell>();
Interface:
public interface IShell
{
void InitializeComponent();
}
public partial class Shell : Window, PrismDashboard.IShell
No comments:
Post a Comment