Displaying modal dialogs using PRISM 4

…衆ロ難τιáo~ 提交于 2019-12-04 19:07:17

You might be interested in a custom PopupUserControl I have posted on my blog that behaves like that.

Usually I use it like this:

<local:PopupPanel 
    Content="{Binding PopupContent}"
    local:PopupPanel.PopupParent="{Binding ElementName=SomeParentPanel}"
    local:PopupPanel.IsPopupVisible="{Binding IsPopupVisible}">

    <local:PopupPanel.Resources>
        <DataTemplate DataType="{x:Type local:SomeViewModel}">
            <local:SomeView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type local:DifferentViewModel}">
            <local:DifferentView />
        </DataTemplate>
    </local:PopupPanel.Resources>

</local:PopupPanel>

Although you can also just write the Content in the popup instead of binding the Content property

<local:PopupPanel 
    local:PopupPanel.PopupParent="{Binding ElementName=SomeParentPanel}"
    local:PopupPanel.IsPopupVisible="{Binding IsPopupVisible}">

    <Border BorderBrush="Blue" BorderThickness="2">
        <local:MyUserControl />
    </Border>
</local:PopupPanel>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!