1
내가 모달 대화 상자를 표시하려고 내가 현재 쉘 창을 참조해야합니다쉘 윈도우의 현재 인스턴스에 대한 참조를 가져
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>();
내가 갖는 :
Cannot set Owner property to a Window that has not been shown previously.
이것은이다 부트 스트 래퍼
의 코드public class Bootstrapper : UnityBootstrapper
{
protected override System.Windows.DependencyObject CreateShell()
{
Container.RegisterInstance<IShell>(new Shell());
return Container.Resolve<Shell>();
인터페이스 :
public interface IShell
{
void InitializeComponent();
}
public partial class Shell : Window, PrismDashboard.IShell
감사합니다,이 괜찮 았는데. 이것이 어떻게 더 적절한 방법으로 행해질 수 있는지에 대한 다른 제안이 있습니까? Shell이 이미 내 하위 창이있는 프로젝트에 대한 참조를 가지고있는 프로젝트로 하위 창에서 Shell을 사용할 수 없습니다. 해결 방법은 자식 및 셸 프로젝트에서 참조하는 인프라 프로젝트의 IShell입니다. – user007
@ user927827 : 전적으로 컨텍스트에 따라 다릅니다. 인프라 프로젝트와의 협상은 합리적으로 들립니다. – Jon