Need help! I have a test app where I was playing with all the panes and split panes and proportions, just using dummy content. I got it pretty much perfect, and then did what is the next step- embedding a UserControl in a ContentPane. When I do this, it screws up the window resizing and propotions. I am posting the code I used to recreate this problem- Window1.xaml and UserControl1.xaml.
The behavior is very odd, is there something I am doing wrong here? Or is something truly funky happening? If you run it as it stands, it works great- but then if you comment out the rich text box under the PROBLEM AREA comment, and uncomment the UserControl, run it again, and play with resizing the vertical splitter. Things are tweaked.
Here is Window1.xaml:
<Window x:Class="TestApp.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igDock="http://infragistics.com/DockManager" xmlns:local="clr-namespace:TestApp" Title="Window1" Height="600" Width="800"> <Grid> <igDock:XamDockManager> <igDock:XamDockManager.Panes> <igDock:SplitPane> <igDock:SplitPane SplitterOrientation="Vertical" igDock:SplitPane.RelativeSize="25, 100"> <igDock:SplitPane SplitterOrientation="Horizontal"> <igDock:TabGroupPane Padding="2"> <igDock:ContentPane Header="Content Pane 1"> <!-- PROBLEM AREA? Comment out RichTextBox and uncomment UserControl1 --> <RichTextBox VerticalScrollBarVisibility="Auto" /> <!--<local:UserControl1/>--> </igDock:ContentPane> </igDock:TabGroupPane> <igDock:ContentPane Header="A pane"> <StackPanel> <Button Content="Button 1" /> </StackPanel> </igDock:ContentPane> <igDock:ContentPane Header="Stuff"> <ListBox> <ListBoxItem Content="Stuff 1" /> </ListBox> </igDock:ContentPane> </igDock:SplitPane> </igDock:SplitPane> <igDock:SplitPane SplitterOrientation="Horizontal"> <igDock:SplitPane igDock:SplitPane.RelativeSize="100, 400"> <igDock:TabGroupPane> <igDock:ContentPane Header="Another Content Pane"> <RichTextBox VerticalScrollBarVisibility="Auto" /> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane > <igDock:SplitPane> <igDock:ContentPane Header="Little pane"> <StackPanel> <Button Content="Button 1" /> </StackPanel> </igDock:ContentPane> <igDock:TabGroupPane> <igDock:ContentPane Header="Log pane"> <RichTextBox VerticalScrollBarVisibility="Auto" /> </igDock:ContentPane> <igDock:ContentPane Header="Error pane"> <RichTextBox VerticalScrollBarVisibility="Auto" /> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:SplitPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> </igDock:XamDockManager> </Grid></Window>
And UserControl1.xaml:
<UserControl x:Class="TestApp.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> </Grid></UserControl>
It seems like you're trying to use the xamDockManager as if it would fill the available area of the window but the xamDockManager is designed to be a content control so just like VS the panes are docked around a central content area. Since it has been requested several times we will likely add a mode to xamDockManager so that its pane fill the available area.
Now specifically with regards to your snippet you have 1 root docked split pane. Since you haven't specified its InitialLocation, it is docked to the left. Since you haven't set a Width on the root SplitPane its Width is based on the desired size of the children. The children in this case are 2 split panes. So the root split pane happens to get measured with 780, 564. Based on the RelativeSize values for the 2 child split panes they each get measured with 155.2, 564 and 620.8, 564. When the first child contains an RTB and it is measured with that value it returns a desired width of 155.2 but when it contains a UserControl it returns a value of 141.386. This difference comes down to how the UserControl and RTB's values are measured. The UserControl does what most contentcontrols do and just measure the content with the size given and return the size that the content needs so in this case it has no content and it returns 0,0. The RTB (or perhaps its the FlowDocumentView it ultimately contains) ends up returning the size that it was given in its measure. This ultimately results in the root split pane returning that it only needs a portion of the size it was measured with which accounts for why there is 14 extra pixels of space seen in the right edge of your sample when using a usercontrol.