controlsize of toolwindow

Docking/MDI for WPF Forum

Posted 13 years ago by Arthur Damen
Version: 11.2.0551
Avatar
Who can tell me what the value of 125 is in this example?
I try to find out how the value acts, but it does not contain a pixel value of the width of the toolwindow. The size shown at runtime is different.

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

Comments (11)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

If you can give a complete example where it's no working we can determine what the issue is. It should be the number of pixels wide/tall of the container, but it largely depends on the space available. If your window is 200x200, then you can't have two ToolWindowContainers that are 125 pixels wide.


Actipro Software Support

Posted 13 years ago by Arthur Damen
Avatar
The example.
Watch the black textblock (width=100).
Actual it has a value of 200?????

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication1"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    Title="MainWindow" Height="350" Width="725">
  <Grid>
    <docking:DockSite   >
      <docking:SplitContainer Orientation="Horizontal" Name="SplitContainer1">

        <docking:SplitContainer Orientation="Vertical" Name="SplitContainer3">

          <docking:ToolWindowContainer>
            <docking:ToolWindow>
              <ListBox  Background="Green" ></ListBox>
            </docking:ToolWindow>
          </docking:ToolWindowContainer>

          <docking:ToolWindowContainer docking:DockSite.ControlSize="0,70">
            <docking:ToolWindow HasTitleBar="False" >
              <ListBox  Background="Red"  ></ListBox>
            </docking:ToolWindow>
          </docking:ToolWindowContainer>
        </docking:SplitContainer>

        <docking:ToolWindowContainer docking:DockSite.ControlSize="100,100">
          <docking:ToolWindow>
            <Grid>
              <TextBlock Background="Black" Width="100" ></TextBlock>
            </Grid>
          </docking:ToolWindow>
        </docking:ToolWindowContainer>

      </docking:SplitContainer>

    </docking:DockSite>
  </Grid>
</Window>
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

Yeah, what you have below is what we call Inner Fill, since you don't have a Workspace to take up the remaining space. In this mode, the ControlSize is a ratio, instead of a specific height/width. The controls where you don't specifiy a ControlSize default to "200,200". So you are saying that the ToolWindowContainer with the TextBlock should take up 1/3 of the width of the window's width.


Actipro Software Support

Posted 13 years ago by Arthur Damen
Avatar
if i remove the docking:DockSite.ControlSize="0,70",

the outcome is still the same..
The left green/red panel should fill out the area automatically.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

I'm not sure what you mean. The "0,70" control size in your example would only affect the heights of the green and red ToolWindowContainers. If you remove that from your example above, then the red/green ToolWindowContainers will have the same height (i.e. 50% of the available space). Since they are in a SplitContainer that is oriented vertically, the "width" is not used.


Actipro Software Support

Posted 13 years ago by Arthur Damen
Avatar
I want the left red to be less than 50% by default.
besides that the black part should be less than 50% also.

So i want each part by default to have a certain value other than 50%
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

With what you have above, the ToolWindows will fill the entire space. So you cannot have the left column (i.e. green/red) be less than 50% and the right column (i.e black) be less than 50%. If that is what you want, then you'd have to add a Workspace to fill the remaining area.

If you are referring to wanting the red to be less than 50% in height, and the black to be less than 50% in width, then what you have above does accomplish that.


Actipro Software Support

Posted 13 years ago by Arthur Damen
Avatar
I mean the red part (vertical) must be smaller (a footer area)

Horizontal I want the black part to be let's say 150 pixels width.

"If you are referring to wanting the red to be less than 50% in height, and the black to be less than 50% in width, then what you have above does accomplish that."

That is the problem. The black part width is invalid as shown in my example.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

If you want the red area to have a shorter height, then you'd have to use a value less than 70. I'm getting confused, as you said removing the docking:DockSite.ControlSize="0,70" part resulted in the same outcome, which is not what I observed. You never clarified what you meant by that. When you remove the docking:DockSite.ControlSize="0,70" part do you see the green and red area getting 50% of the vertical space?

As for the horizontal sizing, as I mentioned that's not easily accomplished with Inner Fill, as the sizes are porportions. You could use proportions that are equal to the width of the content area of the window. In my case, the window's width is 525 (per your example), which gives a width of 509 for the content. Taking splitters into account (which are 5 pixels tall/wide), that means you could do something:
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication1"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    Title="MainWindow" Height="350" Width="725">
  <Grid>
    <docking:DockSite   >
      <docking:SplitContainer Orientation="Horizontal" Name="SplitContainer1">

        <docking:SplitContainer Orientation="Vertical" Name="SplitContainer3" docking:DockSite.ControlSize="404,100">

          <docking:ToolWindowContainer>
            <docking:ToolWindow>
              <ListBox  Background="Green" ></ListBox>
            </docking:ToolWindow>
          </docking:ToolWindowContainer>

          <docking:ToolWindowContainer docking:DockSite.ControlSize="0,70">
            <docking:ToolWindow HasTitleBar="False" >
              <ListBox  Background="Red"  ></ListBox>
            </docking:ToolWindow>
          </docking:ToolWindowContainer>
        </docking:SplitContainer>

        <docking:ToolWindowContainer docking:DockSite.ControlSize="100,100">
          <docking:ToolWindow>
            <Grid>
              <TextBlock Background="Black" Width="100" ></TextBlock>
            </Grid>
          </docking:ToolWindow>
        </docking:ToolWindowContainer>

      </docking:SplitContainer>

    </docking:DockSite>
  </Grid>
</Window>
You may need to tweak the sizes a pixel or two to account for rounding.


Actipro Software Support

Posted 13 years ago by Arthur Damen
Avatar
Let's start over again:
The example is a window of 800 pixels width.
I tell the toolwindow that the left is at 400 (half of the window) pixels.

The xaml window shows the green (left part) width aprox at 150 pixels width????
It should show it precisely in the middle with this value.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication1"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    Title="MainWindow" Height="400" Width="800">
  <Grid>
    <docking:DockSite   >
      <docking:SplitContainer Orientation="Horizontal" Name="SplitContainer1">

          <docking:ToolWindowContainer>
            <docking:ToolWindow>
              <ListBox  Background="Green" ></ListBox>
            </docking:ToolWindow>
          </docking:ToolWindowContainer>

        <docking:ToolWindowContainer docking:DockSite.ControlSize="400,100">
          <docking:ToolWindow>
            <Grid Background="Black"></Grid>
          </docking:ToolWindow>
        </docking:ToolWindowContainer>

      </docking:SplitContainer>

    </docking:DockSite>
  </Grid>
</Window>
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

No, that is incorrect. The green ToolWindowContainer has a default ControlSize of "200,200". Since you are using Inner Fill (i.e. no Workspace), then control sizes are proportions. So effectively the green ToolWindowContainer will get 2/6 of the width and the black ToolWindowContainer will get 4/6 of the width.

If I run your sample, the window is exactly 800 pixels wide, the green ToolWindowContainer is 256 pixels wide, and the black ToolWindowContainer is 513 pixels wide. Taking into account the window's border, the window's content (i.e. the DockSite) can be 784 wide. The DockSite has a 5 pixel padding all around, so we have 774 pixels for it's content (i.e. the ToolWindowContainers). Since you have two ToolWindowContainer's you will need 1 splitter, which is 5 pixels wide, giving us a total of 769 pixels to divide between the two ToolWindowContainers. So to calculate the width of the green ToolWindow we use 769 * 2/6 = 256.33333, which is rounded down to 256. The same is done for the black ToolWindowContainer where we use 769 * 4/6 = 512.66666, which is rounded up to 513.


Actipro Software Support

The latest build of this product (v24.1.3) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.