你能告诉我如何设置我的usercontrol的宽度(这取决于主窗口)。通过PRISM?
我尝试在Xaml中使用Application.Current.Window.Width,但它在那里不起作用。
这是我的代码:
<prism:InteractionRequestTrigger SourceObject="{Binding ShowExpressionHelpWindowNotificationRequest}">
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" WindowStartupLocation="CenterOwner">
<prism:PopupWindowAction.WindowContent>
<vm:SpreadSheetUserControl Width="{Binding Source={x:Static Application.Current.MainWindow.Width}}"/>
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
任何非棱镜解决方案都可以。
提前谢谢。答案 0 :(得分:1)
试试这个:
<prism:InteractionRequestTrigger SourceObject="{Binding ShowExpressionHelpWindowNotificationRequest}">
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" WindowStartupLocation="CenterOwner"
xmlns:win="clr-namespace:System.Windows;assembly=PresentationFramework">
<prism:PopupWindowAction.WindowContent>
<vm:SpreadSheetUserControl Width="{Binding Path=MainWindow.Width, Source={x:Static win:Application.Current}}"/>
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>