Skip to content

DevExpress-Examples/winforms-create-custom-document-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to create a custom DocumentManager with a custom View and a custom Document

This example demonstrates how to create a custom DocumentManager. Once you place this component onto a form, you can switch (convert) the current View to WidgetView using a smart tag menu. When you create new documents at design time or runtime, custom documents will be created. For demonstration purposes, the example adds a new custom property to the custom Document class. 

Create a custom DocumentManager with a custom View and a custom Document

[ToolboxItem(true)]
public class CustomDocumentManager : DocumentManager {
    public CustomDocumentManager() { }
    public CustomDocumentManager(IContainer container)
        : base(container) {

    }
    protected override void RegisterViews() {
        base.RegisterViews();
        RegisterView<CustomWidgetViewRegistrator>(ViewType.Widget);
    }
    public override BaseView CreateView(ViewType type) {
        if (type == ViewType.Widget) return new CustomWidgetView(Container);
        return base.CreateView(type);
    }
}

Documentation