自定义控件中集合属性在智能标签中的问题。。。。
[DefaultProperty("Columns")]
[ParseChildren(true, "Columns")]
[ToolboxData("<{0}:dGrid runat=server></{0}:dGrid>")]
[Designer(typeof(dGrid_Designer))]
[DesignerAttribute(typeof(dGrid_Designer))]
public class dGrid :WebControl, INamingContainer
{
//创建列的集合属性
private List<Column> _Columns;
[Bindable(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
//[Editor(typeof(columnEditer), typeof(UITypeEditor))]//columnEditer设计器
[Description("列的配置")]
[Category("dGrid配置")]
public List<Column> Columns
{
get
{
if (_Columns == null)
_Columns = new List<Column>();
return _Columns;
}
set
{
_Columns = value;
}
}
// ....其他的省略
}
// 设计时支持类
public class dGrid_Designer : ControlDesigner
{
//设计时htm输出
public override string GetDesignTimeHtml()
{
//.....略
}
//创建一个自定义操作列表集合
public override DesignerActionListCollection ActionLists
{
get
{
DesignerActionListCollection actionLists = new DesignerActionListCollection();
actionLists.Add(new CustomControlActionList(this));
return actionLists;
}
}
}
// 智能标签
internal class CustomControlActionList : DesignerActionList
{
private dGrid_Designer _parent;
private DesignerActionItemCollection items;
public CustomControlActionList(dGrid_Designer parent)
: base(parent.Component)
{
_parent = parent;
}
// 集合属性
public List<Column> Columns
{
get
{
dGrid ctrl = (dGrid)_parent.Component;
return ctrl.Columns;
}
set
{
PropertyDescriptor propDesc = TypeDescriptor.GetProperties(_parent.Component)["Columns"];
propDesc.SetValue(_parent.Component, value);
}
}
//只能标记的项
public override DesignerActionItemCollection GetSortedActionItems()
{
if (items == null)
{
items.Add(new DesignerActionPropertyItem("Columns","配置列"));
}
return items;
}
}
//Column类
public class Column
{
private string _id;
private string _text;
private bool _visable = true;
public Column()
{
}
public Column(string id, string text, bool visible)
{
_id = id;
_text = text;
_visable = visible;
}
[Description("对应的数据库字段")]
[NotifyParentProperty(true)]
public string Field
{
get
{
return _id;
}
set
{
_id = value;
}
}
[Description("对应表头显示的文字")]
[NotifyParentProperty(true)]
public string Text
{
get
{
return _text;
}
set
{
_text = value;
}
}
[Description("该列是否可见")]
[NotifyParentProperty(true)]
public bool Visable
{
get
{
return _visable;
}
set
{
_visable = value;
}
}
}
目前在设计试图的时候控件右边有个小三角形 按了会弹出智能标签面板。 里面有一个我添加的东西,集合属性也在,样子跟属性栏里的差不多,而且点那个省略号的按钮能弹出集合属性编辑器,能看到当前的集合属性,但是增加,修改,删除都无效,浏览界面也没有更新(这时如果更改一下别的属性什么的,,刚才列的更改就显示出来了。),这个问题在属性栏里的配置这个集合属性时不会发生。属性栏里更改集合属性都即使显示的。 不知道是什么问题。困扰很久了。。。我想到gridview的智能面板上,他是一个编辑列。。按钮 应该是用的是一个方法来弹出集合编辑器。但是我不知道在事件中写弹出集合属性的编辑器。。 希望大家帮忙啊 很急啊~~~~~ 谢谢啦 ·········分可以在加··
相关推荐
HTML:自定义标签属性
在实际应用中,有时我们需要为 HTML 元素添加额外的信息或功能,这就需要用到自定义属性。本文将详细介绍如何在 HTML 中添加自定义属性以及在不同浏览器中的兼容性问题。
Android自定义流式标签控件实战开发
在Android开发中,系统提供的标准控件虽能满足常规UI需求,但在面对复杂交互与定制化布局时往往捉襟见肘。流式标签控件广泛应用于搜索热词、兴趣标签、商品筛选等场景,要求具备自动换行、动态增删、多行对齐、样式可配等特性,标准控件难以胜任。通过继承ViewGroup实现自定义容器,开发者可深度掌控测量(onMeasure)、布局(onLayout)、绘制(onDraw)三大流程,构建高性能、高扩展的原生解决方案。相比使用嵌套或引入第三方库(如FlowLayout),自定义。
基于WEB的自定义分页控件实现与演示
在数据展示的场景中,尤其是在Web应用中,我们需要向用户展示大量的数据。由于页面显示空间的限制,一次性加载所有数据并不现实,也不经济。此时,分页控件便发挥了重要作用。分页控件(Pagination Control)是一种用于在有限的显示空间内分批次展示信息的用户界面组件,它允许用户通过点击不同的页面编号来获取新的数据集合。在创建一个自定义分页控件时,样式设计是不可忽视的一环。良好的视觉设计不仅能够提升用户体验,还能够引导用户的操作流程。以下是几个设计自定义分页控件时应遵循的原则和方法。
js 点击a标签 获取a的自定义属性方法
本篇教程提出了一种使用原生JavaScript的方法来解决这个问题。在传统的原生JavaScript中,我们可以通过访问元素的`attributes`集合来获取所有的属性,包括自定义属性。
数据治理之数据标签体系建设模板集合(标签属性+框架+流程).pdf
* 风险管理* 数据分析和报表* 业务智能和决策支持数据标签体系建设模板集合的技术要求包括:* 数据库管理系统* 数据integration和exchange平台* 数据安全和保护系统* 业务智能和决策支持系统数据标签体系建设模板集合的实施步骤包括


