Problem with Window.SizeToContent = SizeToContent.WidthAndHeight

Docking/MDI for WPF Forum

Posted 7 months ago by Yuki
Version: 23.1.3
Platform: .NET 6.0
Environment: Windows 10 (64-bit)
Avatar

Hello,

I had made the following window.

  • SizeToContent="WidthAndHeight"
  • Contains DockSite.AutoHideBottomContainers

I had encountered the following issues.

  • When click "Tool1", tool window will be poped up, but main window's width become screen width.
    • After pinned the tool window, main window's width become original width.
  • Make tool window pinned. When switch Tool1 <--> Tool2, main window' height is changed.
    • When make Tool1's height smaller,  main window's height become smaller.


Would you please check it?

Regarding to 1st issue, it was solved by specify `DockSite.UseHostedPopups="False"`.

However, I don't want to use this because initialize process of internal control was not executed properly.

<Window
    x:Class="WpfApp36.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    ResizeMode="NoResize"
    SizeToContent="WidthAndHeight"
    mc:Ignorable="d">
    <Grid>
        <docking:DockSite>
            <docking:DockSite.AutoHideBottomContainers>
                <docking:ToolWindowContainer>
                    <docking:ToolWindow Title="Tool1">
                        <StackPanel>
                            <Label Content="Tool1" />
                            <Button Height="50" Content="Button1" />
                        </StackPanel>
                    </docking:ToolWindow>
                    <docking:ToolWindow Title="Tool2">
                        <StackPanel>
                            <Label Content="Tool2" />
                            <Button Content="Button2" />
                        </StackPanel>
                    </docking:ToolWindow>
                </docking:ToolWindowContainer>
            </docking:DockSite.AutoHideBottomContainers>

            <docking:SplitContainer>
                <docking:Workspace>
                    <docking:ToolWindow
                        Title="Fixed"
                        CanAttach="False"
                        CanDragTab="False"
                        HasTitleBar="False">
                        <StackPanel Margin="8" Orientation="Vertical">
                            <Label Content="Main Area" />
                            <StackPanel Margin="0,16,0,0" Orientation="Horizontal">
                                <Label Content="Name: " />
                                <TextBox Width="300" Margin="0,8,0,0" />
                            </StackPanel>
                            <StackPanel Margin="0,16,0,0" Orientation="Horizontal">
                                <Label Content="Age: " />
                                <TextBox Width="300" Margin="0,8,0,0" />
                            </StackPanel>
                            <StackPanel Margin="0,16,0,0" Orientation="Horizontal">
                                <Label Content="Address: " />
                                <TextBox Width="300" Margin="0,8,0,0" />
                            </StackPanel>
                            <Button
                                Width="100"
                                Margin="0,16,0,0"
                                HorizontalAlignment="Right"
                                Content="Apply" />
                        </StackPanel>
                    </docking:ToolWindow>
                </docking:Workspace>
            </docking:SplitContainer>
        </docking:DockSite>
    </Grid>
</Window>

Best regards,

Comments (4)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

For the first issue, when you set DockSite.UseHostedPopups to false, that makes the popups show in their own separate Popup, which therefore prevents the popup content from affecting any measurements in the main Window.  When that property is the default of true, it's having an AutoHidePopupPanel measure itself.  The current logic is returning the desired width as the available width.  Since the available width for the SizeToContent scenario is being passed in as screen width, that's why it grows wider.  We were able to adjust our code so that doesn't happen, which will be in the next maintenance release.

For the second issue, a docking layout system isn't really designed to be used with a main Window that has SizeToContent supported.  Docking window layouts generally have a central Workspace area that fills whatever space is available and everything "docks" around that.  Due to the nature of how docking windows are dynamically changing layouts and resizing things, they won't work well with SizeToContent on the Window that hosts the DockSite.


Actipro Software Support

Posted 7 months ago by Yuki
Avatar

Hello,

Thank you for your reply.

For the first issue, would you please let me know when next maintenance release is?

Maybe preview version release first?

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We just published a maintenance release so it might be a while before the next one.  You can send us a private ticket if you'd like to request a preview build with the update for the first issue.


Actipro Software Support

Posted 7 months ago by Yuki
Avatar

Hello,

Thank you for your reply.

I'll send you private ticket.

The latest build of this product (v24.1.2) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.