属性类似于Web控件的样式属性 [英] attribute similar to style attribute of web controls

查看:82
本文介绍了属性类似于Web控件的样式属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
晚上好.

我正在控制自己,因为我添加了一个属性.
我希望该属性类似于Web控件的样式属性.

类似地,我想要一个带有子属性的属性.
例如:

Hello everybody,
Good Evening.

I''m making my control in that i have added an attribute.
I want that attribute similar to style attribute of web controls.

By similar I mean, I want an attribute with its sub-attributes.
eg:

<crt:mycontrol id="crt" newattribute="subattribute:value; subattribute2:true" xmlns:crt="#unknown"></crt:mycontrol>



因此,通过上面的示例,我想在控件中将样式属性(style ="width:30; height:50;")添加为"newattribute"的所有对象都将很清楚.

可能吗.如果是,那怎么办?请举例说明...
在此先感谢....



So, by above example it will be clear to all that i want to add ''newattribute'' in my control as style (style="width:30; height:50;") attribute.

Is it possible. If yes, then how? Please explain with examples...
Thanks in advance....

推荐答案

是的,这是可能的.在控件后面的代码中声明一个公共属性,例如,

yes it is possible. In the code behind of the control declare a public property like,

private string filename= string.Empty;

public string FileName
    {
        get
        {
            return this.filename;
        }

        set
        {
            this.filename = value;
        }
    }



现在您可以将此属性用于控件,例如



And now you might use this property to your control like

<crt:mycontrol id="crt" filename="MyTestFileName" xmlns:crt="#unknown">  </crt:mycontrol>


这篇关于属性类似于Web控件的样式属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆