Question

MDI windows in a ribbon window - having issues

Posted 6 years ago by Avatar John Clark
I'm just evaluating the Actipro WPF Studio and am having some issues trying to work with MDI.

I've got a RibbonWindow which has a docksite below it which is set as a standard MDI Host.

I want to make use of buttons on the ribbonbar purely for navigation, and as such in the click event of a button want to load up a further ribbon window (or page) with a ribbon on it as an MDI child.

So I tried this:

private void button1_Click(object sender, ExecuteRoutedEventArgs e)
        {
            
          ActiproSoftware.Windows.Controls.Ribbon.Controls.TextBox content = new ActiproSoftware.Windows.Controls.Ribbon.Controls.TextBox();
          string name = "MyDocumentWindow1"; string title = "Document Window" +DateTime.Now;

          BitmapImage image = new BitmapImage(new Uri("/Images/Test.png", UriKind.Relative));
          wdwAbout mycontent = new wdwAbout(); // wdwAbout is a ribbon window with a ribbon
          DocumentWindow window = new DocumentWindow(dockSite,name, title,image ,mycontent );
         
          window.Activate(true);
                     
        }


Which throws an inner exception: "Window must be the root of the tree. Cannot add Window as a child of Visual."

so.... I tried a Ribbon page instead but that tells me the parent of a page can only be a window or a frame..

Erm... help? ;-)

Thanks,

JC

[Modified at 10/13/2008 06:56 AM]

Comments (8)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Correct, the WPF Window class must be top-level and Pages can only be used in certain areas like a Frame.

You could just put a Ribbon directly as a child of the DocumentWindow. That will work similar to how it looks in a Page where the QAT and application button won't be moved up into the title bar area like they would on a RibbonWindow.

Actipro Software Support
Posted 6 years ago by John Clark
Having come from a winforms background, I'm having some problems adjusting.

If I want to create a whole new 'form' and have that be the content.... what object type should I be using?

Thanks,

JC
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Well since our DocumentWindow is providing the "form"-like UI, you could encapsulate things like a UserControl if you'd like. Also with the latest build you can now make classes that inherit DocumentWindow and make an instance of that custom class. So you could put your Ribbon on your custom DocumentWindow class, etc.

Actipro Software Support
Posted 6 years ago by John Clark
I'd just this very second thought about creating a user control for each of my 'forms'

I'll give this a go... thanks!

JC
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
I would consider the other solution of inheriting DocumentWindow with a custom class even better though since you have similar benefits to a UserControl but you also have direct access to DocumentWindow properties and methods.

Actipro Software Support
Posted 6 years ago by John Clark
But surely without a visual design surface?

(apologies if this seems a little remedial... :-) )
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
I believe it does allow you to use the designer if you have a related XAML code file. The only thing is that if you resize it in the designer, it may store the Width/Height properties, which you should clear before using the window since those need to be dynamic.

Actipro Software Support
Posted 6 years ago by John Clark
Hmmmm, getting a little more messy than I'd hoped for!

Watch this space :-)
Information The latest build of this product (2014.1 build 0602) was released 3 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.