tabbed document interface in WPF using only on-board means?

穿精又带淫゛_ 提交于 2019-12-01 05:45:35

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!