SplitContainer and children width

Docking/MDI for WPF Forum

Posted 4 years ago by Michael Jelley
Version: 14.1.0600
Avatar

Is there any way to set a width for a child of a SplitContainer in a docksite containing ToolWindowContainers? In my testing, it seems splits always divide the children evenly, even if one child is given a specific width. In XAML, I want to give one child (another SplitContainer) a particular width, and have the other(s) fill in the remaining space.

I have a somewhat standard example of 3 ToolWindows split so one takes up half horizontally, and the other two take the remaining half, split vertically. Below I've pasted the example setup for my dock site.

Thanks!

<docking:DockSite>
	<docking:SplitContainer Orientation="Horizontal">
		<docking:ToolWindowContainer>
			<docking:ToolWindow Title="Left">
				<ScrollViewer>
					<TextBlock TextWrapping="Wrap">... example text</TextBlock>
				</ScrollViewer>
			</docking:ToolWindow>
		</docking:ToolWindowContainer>
		<!-- 
			I want this split container to have a width, or take up a smaller percentage, not 50%.
			If working with a Grid, this would be done as part of the column definition.
		  -->
		<docking:SplitContainer Orientation="Vertical">
			<docking:ToolWindowContainer>
				<docking:ToolWindow Title="Upper Right">
					<ScrollViewer>
						<TextBlock TextWrapping="Wrap">... example text</TextBlock>
					</ScrollViewer>
				</docking:ToolWindow>
			</docking:ToolWindowContainer>
			<docking:ToolWindowContainer>
				<docking:ToolWindow Title="Lower Right">
					<ScrollViewer>
						<TextBlock TextWrapping="Wrap">... example text</TextBlock>
					</ScrollViewer>
				</docking:ToolWindow>
			</docking:ToolWindowContainer>
		</docking:SplitContainer>
	</docking:SplitContainer>
</docking:DockSite>

Comments (1)

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Michael,

You can use the DockSite.ControlSize attached property to set sizes.  For instance if my DockSite had a roughly 600px width, I might do this on your first ToolWindowContainer:

<docking:ToolWindowContainer docking:DockSite.ControlSize="400,400">

And then this on the SplitContainer right under the comment:

<docking:SplitContainer Orientation="Vertical" docking:DockSite.ControlSize="200,400">

That will get the split container to be 1/3 the total width.  You can also programmatically resize SplitContainer children as seen in some of the QuickStarts like "Programmatic Sizing".


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.