Questions about WindowControl

Docking/MDI for WPF Forum

Posted 15 years ago by Matthew Buffington
Version: 4.5.0487
Avatar
Is it possible to use a WindowControl with a StandardMdiHost? I've tried a few combinations and couldn't get it to work. This kinda left me wondering how the WindowControl is used generally?

Anyone have any cases where they chose to use the WindowControl?

I'm trying to build a "panel" that will be shown modal when the user clicks on the button in a combobox instead of the default popup. I was thinking of using the WindowControl as housing my panel, but things don't seem to be working out so far.

Thanks for any thoughts,
Matthew

Comments (8)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matthew,

Actually standard MDI does use WindowControl right now. It templates the docking windows to use WindowControl in the templates. It does all that automatically.

If you want to make a modal window, you'd want to probably create a border that completely covers your main window and has a semi-transparent background, then center a WindowControl instance in that. That would block mouse input at least to the main window and would appear like a modal dialog is displayed.


Actipro Software Support

Posted 15 years ago by Matthew Buffington
Avatar
Hmmm maybe I am missing something then. If I put the following in a window, I get some very strange visual issues and when I try to close the form a null reference exception is thrown.

<ap:DockSite>
<ap:Workspace>
<ap:StandardMdiHost>
<ap:WindowControl Height="200" Width="200" />
</ap:StandardMdiHost>
</ap:Workspace>
</ap:DockSite>

Am I approaching this incorrectly?

Thanks,
Matthew
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matthew,

Yes, that is not an allowed hierarchy. Please read the "Control Hierarchy" topic in the documentation for details on what can be in what.

You never need to use WindowControl directly in a StandardMdiHost. As I mentioned, WindowControl is part of a DocumentWindow's template when the DocumentWindow is in a StandardMdiHost.

So to fix your code, simply replace your WindowControl line with:
<ap:DocumentWindow />
And if you do that you will see a standard MDI window in the workspace.


Actipro Software Support

Posted 15 years ago by Matthew Buffington
Avatar
Ok, so we are not supposed to use the WindowControl directly? I was trying to use it because I'd like to use a window with no border or title bar and WindowControl has a WindowStyle property that seems to do this while DocumentWindow does not.

Is there a way to make DocumentWindow display no border or title bar?

Thanks,
Matthew
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You can use it but not directly in the Docking control hierarchy. Perhaps you could place your customized WindowControl style in the Resources section of the StandardMdiHost. This way the WindowControl instances that are part of the template for DocumentWindow would inherit your style.


Actipro Software Support

Posted 15 years ago by Matthew Buffington
Avatar
I'm not sure what you mean. The two classes seem to be different forks in the inheritance tree (DocumentWindow and WindowControl both derive from ContentControl).

Is there any way to display a DocumentWindow without the window border / Title bar?

Matt
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Matthew,

StandardMdiWindowControl (inheriting WindowControl) is a control that is used within the template of a DocumentWindow in standard MDI. Note that StandardMdiWindowControl was added in 2009.1 I believe so if you are on an older version it may still be WindowControl used here.

What I'm talking about is altering the template of the StandardMdiWindowControl to only show the content, although you may wish to put some border around it.

Here is a sample that works with v2009.1 code that shows what I mean (it probably won't compile in v4.5):
<docking:DockSite>
    <docking:Workspace>
        <docking:StandardMdiHost>
            <docking:StandardMdiHost.Resources>
                <Style TargetType="docking:StandardMdiWindowControl">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="docking:StandardMdiWindowControl">
                                <ContentPresenter />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </docking:StandardMdiHost.Resources>
            
            <docking:DocumentWindow Title="11111">
                <Button>Test</Button>
            </docking:DocumentWindow>
            <docking:DocumentWindow Title="22222">
                <Button>Test</Button>
            </docking:DocumentWindow>
        </docking:StandardMdiHost>
    </docking:Workspace>
</docking:DockSite>


Actipro Software Support

Posted 14 years ago by Matthew Buffington
Avatar
This was absolutely what I was looking for. I upgraded to the 2009.1 version and everything went smoothly. Thank you so much!
The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.