缺少智能感知在描述定制控件属性以声明 [英] Missing Intellisense While Describing Custom Control Properties Declaratively

查看:112
本文介绍了缺少智能感知在描述定制控件属性以声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直在做这个项目了几天,现在,一直无法得到解决为我的自定义的内部特性的IntelliSense支持用户控件的问题(ASCX,你介意)。

So, I've been working on this project for a few days now, and have been unable to resolve the issue of getting intellisense support for my custom-defined inner properties for a user control (ascx, mind you).

我已经看到了解决这个(使用服务器控件,介意的.cs你)很多次。在这个<一个拼写href=\"http://www.robertwray.co.uk/blog/2008/02/describing-aspnet-control-properties-declaratively.html\"相对=nofollow>文章,非常好。而除了使用智能感知的ascx控制一切为我工作。

I have seen the solution to this (using server controls, .cs mind you) many times. Spelled out in this article very well. Everything works for me while using ascx controls except intellisense.

下面是我的code的概要:

Here's the outline of my code:

[PersistChildren(true)]
[ParseChildren(typeof(BreadCrumbItem))]
[ControlBuilder(typeof(BreadCrumbItem))]
public partial class styledcontrols_buttons_BreadCrumb : System.Web.UI.UserControl
{
    ...

    [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
    public List<BreadCrumbItem> BreadCrumbItems
    {
        get { return _breadCrumbItems; }
        set { _breadCrumbItems = value; }
    }

    ...

    protected override void AddParsedSubObject(object obj)
    {
            base.AddParsedSubObject(obj);
            if (obj is BreadCrumbItem)
                    BreadCrumbItems.Add(obj as BreadCrumbItem);
    }

    ...

    public class BreadCrumbItem : ControlBuilder
    {
        public string Text { get; set; }
        public string NavigateURL { get; set; }

        public override Type GetChildControlType(string tagName, System.Collections.IDictionary attribs)
        {
            if (String.Compare(tagName, "BreadCrumbItem", true) == 0)
            {
                return typeof(BreadCrumbItem);
            }
            return null;
        }
    }
}

下面是我的标志了(这对孩子的对象申报工作正常,只是没有智能感知):

Here's my mark up (which works fine, just no intellisense on the child object declarations):

<%@ Register src="../styledcontrols/buttons/BreadCrumb.ascx" tagname="BreadCrumb" tagprefix="uc1" %>

    ...

<uc1:BreadCrumb ID="BreadCrumb1" runat="server" BreadCrumbTitleText="Current Page">
    <BreadCrumbItem Text="Home Page" NavigateURL="~/test/breadcrumbtest.aspx?iwentsomewhere=1" />
    <BreadCrumbItem Text="Secondary Page" NavigateURL="~/test/breadcrumbtest.aspx?iwentsomewhere=1" />
</uc1:BreadCrumb>

我认为问题出在智能感知引擎如何穿越支持类。所有工作的例子我看这不是ASCX,但Web服务器控件(CS,在编译的程序集)。

I think the issue lies with how the intellisense engine traverses supporting classes. All the working examples I see of this are not ascx, but Web Server Controls (cs, in a compiled assembly).

如果任何人都可以阐明如何与ASCX控制做到这一点一些轻,我AP preciate它。

If anyone could shed some light on how to accomplish this with ascx controls, I'd appreciate it.

推荐答案

我以前从页面移除所有用户控制和指令,然后切换标记到设计视图解决了这个。然后,从Solution Explorer的设计窗口拖动ASCX文件。如果您SWICH回标记视图突然智能感知拿起所有属性。我相信有一个更好的方式,但我从来没有发现一个工程。

I have solved this before by removing all the user controls and directives from the page and then switching the markup to design view. You then drag the ascx file from the solution explorer to the design window. If you swich back to markup view suddenly intelisense picks up all the properties. I am sure there is a better way but i have never found one that works.

这篇关于缺少智能感知在描述定制控件属性以声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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