Maximize button on DocumentWindow

Docking/MDI for WPF Forum

Posted 15 years ago by FinallyInSeattle
Version: 4.5.0484
Avatar
Is there a way to remove the Maximize button from the DocumentWindow (other than altering the style)? I'm using a StandardMdiHost for the 1st iteration of the application and, for right now, all windows in the Workspace area are to remain maximized. Would it be better for me to use a WindowControl rather than a DocumentWindow since WindowControl has this option?

Thanks for you assistance!

Comments (7)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
There isn't a way in the docking controls object model right now to prevent that however you could do this sort of thing via a Style in your StandardMdiHost.Resources like this:
<docking:StandardMdiHost x:Name="standardMdiHost" WindowsHaveMinimizeButtons="False">
    <docking:StandardMdiHost.Resources>
        <Style TargetType="docking:WindowControl">
            <Setter Property="HasRestoreButton" Value="False" />
            <Setter Property="HasMaximizeButton" Value="False" />
            <Setter Property="ResizeMode" Value="NoResize" />
        </Style>
    </docking:StandardMdiHost.Resources>
    ...


Actipro Software Support

Posted 15 years ago by FinallyInSeattle
Avatar
Thank you - your assistance has been very helpful!

On a related note -

1) I see that a WindowControl has Activated, Deactivated, Closing & Closed events available, yet DocumentWindow doesn't. Is there a way for me to hook to those directly or do I need to refer to the corresponding Window events on the DockSite object?

2) How do I force DocumentWindow's to be Maximized when opened/activated? I tried setting AreWindowsMaximized on the StandardMdiHost and I also added a Setter to the style that you suggested to set WindowState to Maximized. Both still opened the windows in a "Normal" state.

[Modified at 01/15/2009 02:10 PM]
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
1) The DockSite has a lot of WindowXX events that you can use, which will work no matter what location a docking window is in (MDI, docked, floating, etc.).

2) You may want to try doing this in code:
StandardMdiHost.SetStandardMdiWindowState(dockingwindow, WindowState.Maximized)

That should eliminate the need to set WindowState to Maximized in your style.


Actipro Software Support

Posted 15 years ago by FinallyInSeattle
Avatar
Doing a StandardMdiHost.SetStandardMdiWindowState(dockingwindow, WindowState.Maximized) initially achieves the desired result, but appears to lock the window size. When I perform any of the following actions, the maximized window doesn't expand to fill the Workspace area:
  • Collapse the nav pane (this is outside of the DockSite - Docked on the Left)
  • Cause a tool window to autohide on the right side.
  • Resize the splitter between the Workspace & ToolWindowContainer by dragging it
Here's my general layout (I'm programmatically adding documents):

    <docking:DockSite Name="dockSite" AutomationProperties.AutomationId="dockSite" Margin="0,1,0,0" FontSize="{StaticResource DefaultSRContainerFontSize}" 
                       AreDocumentWindowsDestroyedOnClose="False"
                       >
      <docking:SplitContainer Name="mainSplitContainer" AutomationProperties.AutomationId="mainSplitContainer">
          <docking:Workspace AutomationProperties.AutomationId="workSpace">
            <docking:StandardMdiHost Name="standardMdiHost" WindowsHaveMinimizeButtons="False" AutomationProperties.AutomationId="standardMdiHost"
                                     SelectionChanged="internalWindowHost_SelectionChanged">
              <docking:StandardMdiHost.Resources>
                <Style TargetType="docking:WindowControl">
                  <Setter Property="HasRestoreButton" Value="False"/>
                  <Setter Property="HasMaximizeButton" Value="False"/>
                  <Setter Property="ResizeMode" Value="NoResize"/>
                </Style>
              </docking:StandardMdiHost.Resources>
            </docking:StandardMdiHost>
          </docking:Workspace>

        <docking:ToolWindowContainer AutomationProperties.AutomationId="twContainerKnowledgeManagement">
          <docking:ToolWindow Name="toolWindowKnowledgeManagement" Title="Knowledge Management" AutomationProperties.AutomationId="toolWindowKnowledgeManagement">
            <TextBlock Text="Future KM Area" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>            
          </docking:ToolWindow>
        </docking:ToolWindowContainer>


      </docking:SplitContainer>
    </docking:DockSite> 
ON EDIT: I see this behavior in your Standard MDI-only sample app. Maximize one of your DocumentWindows and then resize the width of the outer window. The width of the DocumentWindow stays fixed instead of growing/shrinking with the window - not what I would expect. I'm running version version 4.5.0483.

[Modified at 01/15/2009 10:14 PM]

[Modified at 01/15/2009 10:41 PM]
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hmm, it appears that there was code to keep the height filling the MDI area but not the width. We've corrected it for the next maintenance release. Is that what you see too?


Actipro Software Support

Posted 15 years ago by FinallyInSeattle
Avatar
Yes - that is what I'm seeing. What is your estimate for the next maintenance release? We only have about a 2 week window to retrofit our app into this framework or we'll have to drop the effort.

Thanks for your assistance!
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We just put one out a couple days ago so it may not be for a while. I'll contact you via email to possibly arrange for a preview build with the changes though.


Actipro Software Support

The latest build of this product (v24.1.1) 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.