如何隐藏在设计一个用户控件的内部控制? [英] How to hide the inner controls of a UserControl in the Designer?

查看:123
本文介绍了如何隐藏在设计一个用户控件的内部控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一个DropDownList和一个ObjectDataSource一个用户控件。这种控制是在我的母版的标记使用。

I have a UserControl that contains a DropDownList and an ObjectDataSource. That control is used in the markup of my MasterPage.

在使用该母版,我可以看到的DropDownList和ObjectDataSource控件一个ContentPage的设计师。看到自己。结果

In the Designer of a ContentPage that uses that MasterPage I can see the DropDownList and the ObjectDataSource. See for yourself.

我知道其他的控件(如ComponentArt:网格)只显示为自理外容器和隐藏内部控制

I know that other controls (like ComponentArt:Grid) only show themself as outer container and hide the inner controls.

我想这是带有属性某种程度上可以实现的。哪些是我必须设置?

I guess that is somehow achievable with attributes. Which ones do I have to set?

推荐答案

我猜你指的控制,ComponentArt:网格,有一个相关的 ControlDesigner 它可以做任何事情,包括designtime编辑区和自定义操作菜单(与箭头相关的菜单在右上角)。

I'm guessing that the control you refer to, ComponentArt:Grid, have an associated ControlDesigner which can do about anything, including designtime editable areas and custom action menus (the menu associated with the arrow in the upper right corner).

但是,Visual Studio不会[我最后一次尝试]执行控制设计师为用户控件,所以你不能轻松地控制这一点。有在UserControlDesigner包括解析HTML code中的背景有很多神奇的事情发生的。但是,我从来没有见过codebehind文件,其中ControlDesigner属性将被指定的实际编译。

However, Visual Studio does not [last time I tried] execute the control designer for UserControls, so you can not easily control this. There's a lot of magic happening in the background in the UserControlDesigner including parsing the html code. However, I've never seen actual compilation of the codebehind file, where the ControlDesigner attribute would be specified.

您将需要重写你的控制作为Visual Studio的服务器控件来检查的属性,让您的自定义视图designtime

You will need to rewrite your control as a server control for Visual Studio to check for the attribute, and allowing your custom designtime view.

这篇关于如何隐藏在设计一个用户控件的内部控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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