数据库:C_ProductPlan ,C_ProductPlanItem
DTO定义:(实现每个计划条目-Master,对应多个ProcessInfo-Detail)

    [DataContract]
[Serializable]
public class PlanInfo:C_ProductPlan
{
public PlanInfo()
{
Items = new List<ProducePlanItem>();
} [DataMember]
public List<ProducePlanItem> Items { get; set; }
} [DataContract]
[Serializable]
public class ProducePlanItem :C_ProductPlanItem
{ public ProducePlanItem()
{
ProcessConfig = new List<ProcessInfo>();
} [DataMember]
public List<ProcessInfo> ProcessConfig { get; set; } } [Serializable]
public class ProcessInfo
{
public String Name{get;set;}
public int Order{get;set;}
public bool? IsChecked{get;set;}
public String Memo{get;set;}
}

UI定义:
index-是行记录,relationIndex是对应的子集合序号(可以有多个子集合),IsEmpty=true时主列表前面的"+"灰色
getCount 返回最大的子集合数

   public class ProducePlanItems : ArrayList, IRelationList
{
public ProducePlanItems()
{ } #region IRelationList 成员 public System.Collections.IList GetDetailList(int index, int relationIndex)
{
return this[index].ProcessConfig;
} public string GetRelationName(int index, int relationIndex)
{ return "ProcessConfig";
} public bool IsMasterRowEmpty(int index, int relationIndex)
{
return false;
} public int RelationCount
{
get { return ; }
} #endregion public virtual new ProducePlanItem this[int index]
{
get { return base[index] as ProducePlanItem; }
}
}

需要引用Dexexpress.Data.dll,

1.gridview-MainView 绑定到UI中定义的ProducePlanItems.

2.添加一个level1 将level1重命名称ProcessConfig(对应上面IRelationList.GetRelationName的返回
 
 3.level1 添加 gridview2 ,需要手动设置gridview的列,可以设置gridview2的ViewCaption

4.获取数据后将items转化成producePlanItems,并绑定到UI

DevExpress gridcontrol Master-Detail绑定到对象类型的更多相关文章

  1. element-ui 使用 Select 组件给 value 属性绑定对象类型

    qq_36437172 2020-06-28 22:38:49  778  收藏 分类专栏: element-ui 文章标签: element-ui Select 组件 value 属性 绑定 对象类 ...

  2. DevExpress GridControl导出ExportToXls 数字类型显示成货币格式

    用Dev开发很习惯直接用自带控件导出Excel,现在很少使用原生的Excel API去操作了.除非需要详细的控制. 但别人家封装好的就得按人家的规则的.在使用GridControl导出Excel时发现 ...

  3. DevExpress GridControl使用(转)

    DevExpress GridControl使用 (一)原汁原味的表格展示 Dev控件中的表格控件GridControl控件非常强大.不过,一些细枝末节的地方有时候用起来不好找挺讨厌的.使用过程中,多 ...

  4. Win10 UWP开发系列:实现Master/Detail布局

    在开发XX新闻的过程中,UI部分使用了Master/Detail(大纲/细节)布局样式.Win10系统中的邮件App就是这种样式,左侧一个列表,右侧是详情页面.关于这种 样式的说明可参看MSDN文档: ...

  5. DevExpress GridControl使用方法

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...

  6. ASP.NET Core的配置(3): 将配置绑定为对象[下篇]

    我们在<读取配置信息>通过实例的形式演示了如何利用Options模型以依赖注入的方式直接获取由指定配置节绑定生成的Options对象,我们再次回顾一下当初我们编写的程序.如下面的代码片段所 ...

  7. ASP.NET Core的配置(3): 将配置绑定为对象[上篇]

    出于编程上的便利,我们通常不会直接利用ConfigurationBuilder创建的Configuration对象读取某个单一配置项的值,而是倾向于将一组相关的配置绑定为一个对象,我们将后者称为Opt ...

  8. DevExpress GridControl 使用方法技巧 总结 收录整理

    一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 ().gridView.AddNe ...

  9. Devexpress GridControl z

    http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...

随机推荐

  1. shutil模块(高级的文件copy)

    import shutil import os f1 = open('本节笔记.txt', encoding = 'utf-8') f2 = open('笔记2', 'w', encoding = ' ...

  2. Redis基本操作-list

    Redis的5种数据结构:string.list.hash.set和zset; Redis 所有的数据结构都是以唯一的 key 字符串作为名称,然后通过这个唯一 key 值来获取相应的 value 数 ...

  3. com.google.gson的SerializedName解决实体类与关键字的重名

    使用google的gson包,解决实体类中字段与java关键字的重名: // 比如 当实体类中有switch关键字时,解决冲突如下 @SerializedName("switch" ...

  4. COM组件三大接口IUnknown、IClassFactory、IDispatch。

    转自:http://blog.csdn.net/chenyujing1234/article/details/7753863 (1)COM组件有三个最基本的接口类,分别是IUnknown.IClass ...

  5. div 自动全屏高度

    最近做一个页面,需要一个div自动铺满全屏,但是高度总是难以搞定.查资料为:需要从html body到div 需要 设置 高度属性 为100%

  6. Python itertools/内置函数

    https://docs.python.org/3.5/library/itertools.html#itertools.starmap // https://docs.python.org/3.5/ ...

  7. django提交post请求

    在做post的时候,view.py用到了下面的方法,如果是POST的method,就通过request.POTST['XX']获得html中name为XX的值,然后将值save到数据库里 models ...

  8. input限制数字输入

    onkeyup="this.value=this.value.replace(/\D/g,'')"

  9. Largest Rectangle in a Histogram(附上几组测试数据)

    Largest Rectangle in a Histogram http://acm.hdu.edu.cn/showproblem.php?pid=1506 Time Limit: 2000/100 ...

  10. Ubuntu --- not enough free disk space

    Ubuntu系统更新时出现not enough free disk space. 原因是系统的就内核占满了/boot 的空间,只要将旧内核删除就ok了 首先,命令 uname -r  查看当前内核,( ...