Prism 4.2/5.0 - Problems with GridSplitter

Topics: Prism v4 - WPF 4
Apr 25, 2014 at 5:32 PM
GridSplitter seems to be not working correctly with prism:PopUpWindowAction. To reproduce the behavior
  • Open the <Quickstarts>\Interactivity\InteractivityQuickstart\Views\CustomPopupView.xaml
  • Remove the Width="400" from line 7
  • Replace the entire Grid with the following code:
<Grid Margin="5"
          ShowGridLines="False">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"
                              MinWidth="50" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*"
                              MinWidth="50" />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0"
                    Margin="5">
            <Expander Header="Test1"
                      FlowDirection="LeftToRight"
                      ExpandDirection="Down"
                      IsExpanded="True"
                      BorderBrush="Gray"
                      BorderThickness="1"
                      Padding="5">
                <StackPanel>
                    <Button>Text1</Button>
                </StackPanel>
            </Expander>
        </StackPanel>
        <GridSplitter Grid.Column="1"
                      Margin="0 5"
                      ResizeDirection="Columns"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      Width="3"
                      Background="Gray" />
        <StackPanel Grid.Column="2"
                    Margin="5">
            <Expander Header="Test2"
                      FlowDirection="LeftToRight"
                      ExpandDirection="Down"
                      IsExpanded="True"
                      BorderBrush="Gray"
                      BorderThickness="1"
                      Padding="5">
                <StackPanel>
                    <Button>Text2</Button>
                </StackPanel>
            </Expander>
        </StackPanel>
    </Grid>
  • Build and Run the solution. Go to the Interaction Requests tab and select the Raise Custom Popup View Interaction button.
  • Don't resize the window, but try to move the splitter. It won't work, until you resize the window.
I know that the splitter requires an initial Width to work properly, but if you set it as a UserControl property then try to resize the window, the Grid won't stretch!
Apr 25, 2014 at 9:13 PM
Hi,

I was able to reproduce your issue successfully. However, I don't seem this behavior would be related to any Prism feature or configuration.
I would suggest you to ask on the WPF forum site as you may find more helpful support for the scenario you described:

Regards.
Gabriel Ostrowsky
https://blogs.southworks.net/gostrowsky
Apr 25, 2014 at 9:26 PM
Hi,

Thanks for your quick response. Well, I created a non-Prism based simple application which shows a dialog and the dialog has a user control (with the code above) in it. That one works correctly!
Coordinator
Apr 25, 2014 at 11:16 PM
I think the issue is that the PopupWindowAction sizes the popup window to the size of the content:
            Window wrapperWindow = this.GetWindow(args.Context);
            wrapperWindow.SizeToContent = SizeToContent.WidthAndHeight;
I noticed that once I resized the popup window, the GridSplitter starts working. If you set the SizeToContent property of your non-Prism popup window to SizeToContent.WidthAndHeight, I think you'll see the same behavior.