Devexpress WidgetView 使用总结

效果图:

1.添加DocumentManager控件

2.Convert to WidgetView 

3.添加Document,设定ControlTypeName属性,第5步用到

4.添加StackGroup,在Layout页右侧

5.订阅QueryControl事件(*注意)

        private void widgetView1_QueryControl(object sender, DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Document.ControlTypeName))
                e.Control = Activator.CreateInstance(Type.GetType(e.Document.ControlTypeName)) as Control;
            else
                e.Control = new Control();
        }

6.默认是Stack布局,若想表格摆放,修改Views的LayoutMode属性,并添加Rows和Columns集合。

并设置Document所在的行号和列号。

原文地址:https://www.cnblogs.com/yutian/p/5614360.html