Reputation: 165
I'm using custom popupwindow for show some content to user.
<i:Interaction.Triggers>
<mvvm:InteractionRequestTrigger SourceObject="{Binding NotificationRequest}">
<mvvm:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<mvvm:PopupWindowAction.WindowContent>
<views:DataFeedManagerView/>
</mvvm:PopupWindowAction.WindowContent>
</mvvm:PopupWindowAction>
</mvvm:InteractionRequestTrigger>
</i:Interaction.Triggers>
Everything is works fine until user try to resize popup window. Content will be centered to it's parent window.
For understand what is my fault, i try to explore prism's interactivity samples and i see there is same problem too. How can i solve this problem?
Upvotes: 1
Views: 1402
Reputation: 165
I want to apologize to you(mm8) because my question is incomplete, so your answer is incomplete too. I understand that after see your answer.
Why your answer not solve my problem? Because my DataFeedManagerView which is have to Width="960" and Height="540" fixed length. There is a items control on the left side when selection is changed, there is content control at the center and its content dynamically changing(of course content size is changing too) vs selection.
Delayed detailing & solution. First xaml in my question from my ShellView, my popup window is DataFeedManagerView which is have Width="960" and Height="540" fixed length. So when i resize popup window it will centered to my user control. So shortly only delete width & height xaml parts from DataFeedManagerView, it will be stretch to popup window content like i want. But after delete, when popup window show on screen, it's size will be too large and again i want to set it's size to fixed values. For solve this also i'll give a style to popup window. So my problem's solution is delete fixed width&height properties from DataFeedManagerView and change ShellView xaml like below;
<i:Interaction.Triggers>
<mvvm:InteractionRequestTrigger SourceObject="{Binding NotificationRequest}">
<mvvm:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<mvvm:PopupWindowAction.WindowStyle>
<Style TargetType="Window">
<Setter Property="Width" Value="960"/>
<Setter Property="Height" Value="540"/>
</Style>
</mvvm:PopupWindowAction.WindowStyle>
<mvvm:PopupWindowAction.WindowContent>
<views:DataFeedManagerView/>
</mvvm:PopupWindowAction.WindowContent>
</mvvm:PopupWindowAction>
</mvvm:InteractionRequestTrigger>
</i:Interaction.Triggers>
I hope my question & answer will be help to others. Thanks.
Upvotes: 4
Reputation: 169270
How can i solve this problem?
In the official Prism samples it is just a matter of removing the explicit width of the CustomPopupView UserControl. You can do this by setting the Width to double.NaN
:
<prism:PopupWindowAction>
<prism:PopupWindowAction.WindowContent>
<views:CustomPopupView Width="NaN" />
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
You should be able to the same for your DataFeedManagerView:
<mvvm:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<mvvm:PopupWindowAction.WindowContent>
<views:DataFeedManagerView Height="NaN" Width="NaN" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</mvvm:PopupWindowAction.WindowContent>
</mvvm:PopupWindowAction>
Upvotes: 1