views:

713

answers:

3

I've seen two threads here about TDI & C#. Both of them didn't really answer the questions I have ...

Since TDIs are pretty much like a standard nowadays, I can hardly imagine, that I have to buy a special control (like AvalonDock or SandDock). This must be possible with built in the tab-control(?) somehow! I don't need special features like dock- and draggable tabitems. Just open every form in a new tab. Thats it.

Like putting every forms content controls into user controls and by request (button, menu click ...) add a new tab and put the corresponding user control on it ... something like this.

How would you do it? This can't be THAT complicated (even for me) or am I missing something?!

thanks a lot!

+4  A: 

Maybe Josh Smith's article on MVVM can give you an idea how to design such user interface. Example being built there is kinda tabbed document interface so you can use it as a starting block.

idursun
Be warned... Josh Smith's article is a great reference, but it is not simple to understand. You'll need a good handle on WPF's databinding to piece this together.
Josh G
FYI, I upvoted for linking to a good reference.
Josh G
Thanks, considering @mad9's previous questions I think he is getting closer to implementing MVVM :)
idursun
I'm all for that. MVVM is a great tool for WPF!
Josh G
Thank you very much, I already have the german version of the article ( http://msdn.microsoft.com/de-de/magazine/dd419663.aspx ) printed, right before me =)
MAD9
+3  A: 

It's not that hard. It seems hard because there are a lot of different ways to do it.

Try this:

<TabControl x:Name="documentArea"/>

Handler for AddForm button:

private void AddFormClick(object sender, RoutedEventArgs e)
{
    object form = GetNewForm();

    documentArea.Items.Add(form);
}

That's it. You have to implement GetNewForm() in one of two ways. Have it return a user control that displays the form.

OR better yet, have it return your document that you want to display. Use a DataTemplate to select the controls to use for displaying this document. This method is going to be more complex to set up.

Josh G
A: 

Blockquote Josh Smith's article is a great reference Thanks for good stuff! Design patterns makes my life better!=)