gridControl 疑难杂症

gridControl --默认添加新行

grvUpstreamMaterial.OptionsView.NewItemRowPosition = NewItemRowPosition.Top;
grvUpstreamMaterial.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True;

问题:如果grvUpstreamMaterial.datasource 绑定了数据,用以上这种方式默认加行。在datasource里面是没有默认添加的行信息。

问题解决:

  BindingList<GetUpstreamMaterialReturnViewModel> upstreamMaterialList = new BindingList<GetUpstreamMaterialReturnViewModel>();
            this.grcUpstreamMaterial.DataSource = upstreamMaterialList;

关键字 BindingList 自己品,必须将数据源转成BindingList  对象才能与新添加的行融为一体。

 

posted @ 2020-08-06 17:08  人走茶亦凉  阅读(264)  评论(0编辑  收藏  举报