CG_LookupDataBoundAttribute类详解
CG_LookupDataBoundAttribute类详解
CG_LookupDataBoundAttribute类定义:
CG_EditorType枚举类型:
DevExpress部分Editor组件支持两种界面呈现方式,标准的Editor,以及表格单元格内置的Editor。
扫一扫加微信
CG_LookupDataBoundAttribute类:
用于定义DataBinderTools类的方法能绑定LookupEdit组件的数据源,应用于CSFramework代码生成器。
命名空间:CSFrameworkV5.CodeGeneratorCore.CG_LookupDataBoundAttribute
定义了CG_LookupDataBoundAttribute特性的方法,在代码生成器工具中,可以给LookupEdit组件选择一个绑定方法,没有定义此特性的方法,不会出现在列表中,如下图所示:
在CSFramework代码生成器中,给当前字段对应的组件选择一个绑定方法,代码生成器会在InitializeForm方法内自动生成一行代码,如下面的BoundUser:
DataBinderTools类BoundUser方法的特性定义:
C# Code:
[CG_LookupDataBoundAttribute("绑定用户资料", CG_EditorType.NormalEditor)]
public static void BoundUser(LookUpEdit lue)
{
//省略....
}
public static void BoundUser(LookUpEdit lue)
{
//省略....
}
C# Code:
/// <summary>
/// 应用于代码生成器, 用于绑定LookupEdit组件的方法
/// </summary>
public class CG_LookupDataBoundAttribute : Attribute
{
private string _BoundName = string.Empty;
private CG_EditorType _EditorType = CG_EditorType.All;
public CG_LookupDataBoundAttribute(string boundName, CG_EditorType editorType)
{
this.BoundName = boundName;
this.EditorType = editorType;
}
/// <summary>
/// 绑定组件的名称
/// </summary>
public string BoundName { get { return _BoundName; } set { _BoundName = value; } }
/// <summary>
/// 绑定类型
/// </summary>
public CG_EditorType EditorType { get { return _EditorType; } set { _EditorType = value; } }
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// 应用于代码生成器, 用于绑定LookupEdit组件的方法
/// </summary>
public class CG_LookupDataBoundAttribute : Attribute
{
private string _BoundName = string.Empty;
private CG_EditorType _EditorType = CG_EditorType.All;
public CG_LookupDataBoundAttribute(string boundName, CG_EditorType editorType)
{
this.BoundName = boundName;
this.EditorType = editorType;
}
/// <summary>
/// 绑定组件的名称
/// </summary>
public string BoundName { get { return _BoundName; } set { _BoundName = value; } }
/// <summary>
/// 绑定类型
/// </summary>
public CG_EditorType EditorType { get { return _EditorType; } set { _EditorType = value; } }
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
CG_EditorType枚举类型:
DevExpress部分Editor组件支持两种界面呈现方式,标准的Editor,以及表格单元格内置的Editor。
C# Code:
/// <summary>
/// Editor组件类型, DevExpress部分组件支持两种类型
/// </summary>
public enum CG_EditorType
{
/// <summary>
/// 生成所有类型的Edit组件
/// </summary>
All = 0,
/// <summary>
/// 标准Editor,能拖放在Panel容器内
/// </summary>
NormalEditor = 1,
/// <summary>
/// 表格中内置的Editor
/// </summary>
RepositoryItemEditor = 2
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// Editor组件类型, DevExpress部分组件支持两种类型
/// </summary>
public enum CG_EditorType
{
/// <summary>
/// 生成所有类型的Edit组件
/// </summary>
All = 0,
/// <summary>
/// 标准Editor,能拖放在Panel容器内
/// </summary>
NormalEditor = 1,
/// <summary>
/// 表格中内置的Editor
/// </summary>
RepositoryItemEditor = 2
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网