This project has moved. For the latest updates, please go here.

Bigger ChildWindow and Main Window grid

Apr 5, 2011 at 7:47 PM
Edited Apr 5, 2011 at 7:54 PM

I've been using the childWindow control for quite a while without any issues. But for the first time I needed a "bigger" child window than usual. When opening my child window, it would affect the mainwindow as it was declared like this :

<Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
<!-- Main Grid -->
      <extToolkit:ChildWindow Caption="Test" IsModal="True" WindowState="{Binding Path=IsTestAdded, Converter={StaticResource boolToWindowState}}">
         <local:FeeAdd />
      </extToolkit:ChildWindow>
</Grid>

The fact is that this code makes the child window part of the grid (in (0,0)), and any resizing of the child window would have an effect on the main window grid. A solution we found was to isolate the child window, so that it has no effect on the main grid :

<Grid>
<Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
<!-- Main Grid -->
</Grid>
     <extToolkit:ChildWindow Caption="Test" IsModal="True" WindowState="{Binding Path=IsTestAdded, Converter={StaticResource boolToWindowState}}">
         <local:FeeAdd />
      </extToolkit:ChildWindow>
</Grid>

I would gladly add this to the documentation, unless there is an easier alternative that I am not aware of :) 

Apr 5, 2011 at 8:04 PM

Since the ChildWindow is part of the visual tree it will be contained within the parent element.  So you simply just need to add a Grid.RowSpan="2".

Apr 5, 2011 at 8:13 PM

Of course, if the second row is only for the ChildWindow, you can just delete the second RowDefinition all together.

<Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
<!-- Main Grid -->
      <extToolkit:ChildWindow Caption="Test" IsModal="True" WindowState="{Binding Path=IsTestAdded, Converter={StaticResource boolToWindowState}}">
         <local:FeeAdd />
      </extToolkit:ChildWindow>
</Grid>

Apr 5, 2011 at 8:30 PM

Yep the rowspan was an alternate solution. But we prefered not having to "load" more the childwindow with something really specific to the main window. We ended up with the previous solution as we wanted to split as much as possible the main window from the child window with a minimum of code and an easily reusable pattern. So far it works well :)