protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService service = (ITemplateEditingService)this.GetService(typeof(ITemplateEditingService));
            DataList viewControl            = (DataList)base.ViewControl;

            string[] templateNames  = null;
            Style[]  templateStyles = null;
            switch (verb.Index)
            {
            case 0:
                templateNames  = ItemTemplateNames;
                templateStyles = new Style[] { viewControl.ItemStyle, viewControl.AlternatingItemStyle, viewControl.SelectedItemStyle, viewControl.EditItemStyle };
                break;

            case 1:
                templateNames  = HeaderFooterTemplateNames;
                templateStyles = new Style[] { viewControl.HeaderStyle, viewControl.FooterStyle };
                break;

            case 2:
                templateNames  = SeparatorTemplateNames;
                templateStyles = new Style[] { viewControl.SeparatorStyle };
                break;
            }
            return(service.CreateFrame(this, verb.Text, templateNames, viewControl.ControlStyle, templateStyles));
        }
        /// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.GetTemplateEditingVerbs"]/*' />
        public TemplateEditingVerb[] GetTemplateEditingVerbs()
        {
            if (templateVerbHandler == null)
            {
                ITemplateEditingService teService =
                    (ITemplateEditingService)GetService(typeof(ITemplateEditingService));
                Debug.Assert(teService != null, "Host that does not implement ITemplateEditingService is asking for template verbs");
                if (teService == null)
                {
                    return(null);
                }

                templateVerbHandler = new EventHandler(this.OnTemplateEditingVerbInvoked);
            }
            TemplateEditingVerb[] templateVerbs = GetCachedTemplateEditingVerbs();

            if ((templateVerbs != null) && (templateVerbs.Length > 0))
            {
                ITemplateEditingFrame activeTemplateFrame = ActiveTemplateEditingFrame;
                for (int i = 0; i < templateVerbs.Length; i++)
                {
                    templateVerbs[i].Checked = (activeTemplateFrame != null) &&
                                               (templateVerbs[i].EditingFrame == activeTemplateFrame);
                }
            }

            return(templateVerbs);
        }
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingFrame frame = null;

            if ((_templateEditingVerbs != null) && ((IList)_templateEditingVerbs).Contains(verb))
            {
                ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

                if (teService != null)
                {
                    ListView lv             = (ListView)Component;
                    string[] templateNames  = null;
                    Style[]  templateStyles = null;

                    switch (verb.Index)
                    {
                    case HeaderFooterTemplates:
                        templateNames  = HeaderFooterTemplateNames;
                        templateStyles = new Style[] { lv.HeaderStyle, lv.FooterStyle };
                        break;

                    case ItemTemplates:
                        templateNames  = ItemTemplateNames;
                        templateStyles = new Style[] { lv.ItemStyle, lv.EditItemStyle };
                        break;
                    }
                    frame = teService.CreateFrame(this, verb.Text, templateNames, lv.ControlStyle, templateStyles);
                }
            }
            return(frame);
        }
Exemple #4
0
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingFrame frame = null;

            for (int i = 0; i < _templateEditingVerbs.Length; i++)
            {
                if (_templateEditingVerbs[i] == verb)
                {
                    index = i;
                }
            }

            System.Diagnostics.Debug.WriteLine(index.ToString() + ":CreateTemplateEditingFrame");

            if ((_templateEditingVerbs != null) && (index >= 0))             //(_templateEditingVerbs[0] == verb))
            {
                ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

                if (teService != null)
                {
                    Style style = ((WeavverTabControl)Component).ControlStyle;
                    frame = teService.CreateFrame(this, verb.Text, new string[] { "New Tab Template" }, style, null);
                }
            }
            return(frame);
        }
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingFrame frame = null;

            if (null != tmplEditingVerbs)
            {
                ITemplateEditingService tmplEditingService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));
                if (null != tmplEditingService)
                {
                    Style style = ((TemplateMenu)Component).ControlStyle;
                    if (tmplEditingVerbs[0] == verb)
                    {
                        frame = tmplEditingService.CreateFrame(this, verb.Text, new string[] { "Header Template" }, style, null);
                    }
                    if (tmplEditingVerbs[1] == verb)
                    {
                        frame = tmplEditingService.CreateFrame(this, verb.Text, new string[] { "Separator Template" }, style, null);
                    }
                    if (tmplEditingVerbs[2] == verb)
                    {
                        frame = tmplEditingService.CreateFrame(this, verb.Text, new string[] { "Footer Template" }, style, null);
                    }
                }
            }
            return(frame);
        }
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService service = (ITemplateEditingService)this.GetService(typeof(ITemplateEditingService));
            DataGrid viewControl            = (DataGrid)base.ViewControl;

            Style[] templateStyles = new Style[] { viewControl.ItemStyle, viewControl.EditItemStyle, viewControl.HeaderStyle, viewControl.FooterStyle };
            return(service.CreateFrame(this, verb.Text, ColumnTemplateNames, viewControl.ControlStyle, templateStyles));
        }
        /// <include file='doc\DataGridDesigner.uex' path='docs/doc[@for="DataGridDesigner.CreateTemplateEditingFrame"]/*' />
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

            Debug.Assert(teService != null, "How did we get this far without an ITemplateEditingService");

            Style[] templateStyles = new Style[] { dataGrid.HeaderStyle, dataGrid.ItemStyle, dataGrid.AlternatingItemStyle, dataGrid.FooterStyle };

            ITemplateEditingFrame editingFrame =
                teService.CreateFrame(this, verb.Text, ColumnTemplateNames, dataGrid.ControlStyle, templateStyles);

            return(editingFrame);
        }
Exemple #8
0
        /// <summary>
        /// Creates a template editing frame for a specified designer verb.
        /// </summary>
        /// <param name="verb">The template editing verb to create a template editing frame for. </param>
        /// <returns>ITemplateEditingFrame-based frame instance</returns>
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

            string [] templateNames  = new string[1];
            Style[]   templateStyles = new Style[1];

            switch (verb.Index)
            {
            case 0:
                templateNames[0]  = "HeaderTemplate";
                templateStyles[0] = ((Result)Component).HeaderStyle;
                break;

            case 1:
                templateNames[0]  = "StatusTemplate";
                templateStyles[0] = ((Result)Component).StatusStyle;
                break;

            case 2:
                templateNames[0]  = "ItemTemplate";
                templateStyles[0] = ((Result)Component).ItemStyle;
                break;

            case 3:
                templateNames[0]  = "AlternatingItemTemplate";
                templateStyles[0] = ((Result)Component).AlternatingItemStyle;
                break;

            case 4:
                templateNames[0]  = "SeparatorTemplate";
                templateStyles[0] = ((Result)Component).SeparatorStyle;
                break;

            case 5:
                templateNames[0]  = "FooterTemplate";
                templateStyles[0] = ((Result)Component).FooterStyle;
                break;
            }

            ITemplateEditingFrame editingFrame =
                teService.CreateFrame(this, verb.Text, templateNames,
                                      ((Result)Component).ControlStyle, templateStyles);

            return(editingFrame);
        }
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingFrame frame = null;

            if (this.templateEditingVerbs != null)
            {
                ITemplateEditingService teService = (ITemplateEditingService)this.GetService(typeof(ITemplateEditingService));

                if (teService != null)
                {
                    Style  style        = ((WebPartZone)Component).ControlStyle;
                    String templateName = verb.Text.Replace(" ", "");
                    frame = teService.CreateFrame(this, verb.Text, new string[] { templateName }, style, null);
                }
            }

            return(frame);
        }
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService teService =
                (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

            Debug.Assert(teService != null,
                         "How did we get this far without an ITemplateEditingService");

            String[] templateNames             = GetTemplateFrameNames(verb.Index);
            ITemplateEditingFrame editingFrame = teService.CreateFrame(
                this,
                TemplateDeviceFilter,
                templateNames,
                WebCtrlStyle,
                null /* we don't have template styles */);

            editingFrame.InitialWidth = _templateWidth;
            return(editingFrame);
        }
        /// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.OnSetParent"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Notification that is called when the associated control is parented.
        ///    </para>
        /// </devdoc>
        public override void OnSetParent()
        {
            Control control = (Control)Component;

            Debug.Assert(control.Parent != null, "Valid parent should be present!");

            bool enable = false;

            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            Debug.Assert(host != null);

            ITemplateEditingService teService = (ITemplateEditingService)host.GetService(typeof(ITemplateEditingService));

            if (teService != null)
            {
                enable = true;

                Control parent = control.Parent;
                Control page   = control.Page;

                while ((parent != null) && (parent != page))
                {
                    IDesigner designer = host.GetDesigner(parent);
                    TemplatedControlDesigner templatedDesigner = designer as TemplatedControlDesigner;

                    if (templatedDesigner != null)
                    {
                        enable = teService.SupportsNestedTemplateEditing;
                        break;
                    }

                    parent = parent.Parent;
                }
            }

            EnableTemplateEditing(enable);
        }
        public override void OnSetParent()
        {
            Control                 component = (Control)base.Component;
            bool                    enable    = false;
            IDesignerHost           host      = (IDesignerHost)this.GetService(typeof(IDesignerHost));
            ITemplateEditingService service   = (ITemplateEditingService)host.GetService(typeof(ITemplateEditingService));

            if (service != null)
            {
                enable = true;
                Control parent = component.Parent;
                Control page   = component.Page;
                while ((parent != null) && (parent != page))
                {
                    if (host.GetDesigner(parent) is TemplatedControlDesigner)
                    {
                        enable = service.SupportsNestedTemplateEditing;
                        break;
                    }
                    parent = parent.Parent;
                }
            }
            this.EnableTemplateEditing(enable);
        }
        /// <include file='doc\DataListDesigner.uex' path='docs/doc[@for="DataListDesigner.CreateTemplateEditingFrame"]/*' />
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

            Debug.Assert(teService != null, "How did we get this far without an ITemplateEditingService");

            string[] templateNames  = null;
            Style[]  templateStyles = null;

            switch (verb.Index)
            {
            case HeaderFooterTemplates:
                templateNames  = HeaderFooterTemplateNames;
                templateStyles = new Style[] { dataList.HeaderStyle, dataList.FooterStyle };
                break;

            case ItemTemplates:
                templateNames  = ItemTemplateNames;
                templateStyles = new Style[] { dataList.ItemStyle, dataList.AlternatingItemStyle, dataList.SelectedItemStyle, dataList.EditItemStyle };
                break;

            case SeparatorTemplate:
                templateNames  = SeparatorTemplateNames;
                templateStyles = new Style[] { dataList.SeparatorStyle };
                break;

            default:
                Debug.Fail("Unknown Index value on TemplateEditingVerb");
                break;
            }

            ITemplateEditingFrame editingFrame =
                teService.CreateFrame(this, verb.Text, templateNames, dataList.ControlStyle, templateStyles);

            return(editingFrame);
        }
Exemple #14
0
        /// <summary>
        /// Override the CreateTemplateEditingFrame method.
        /// This method takes a TemplateEditingVerb instance as an argument.
        /// TemplateEditingVerb is a designer verb (a class that derives from DesignerVerb)
        /// that enables the template editor to add a command to the control at design time.
        /// </summary>
        /// <param name="verb"></param>
        /// <returns></returns>
        protected override ITemplateEditingFrame CreateTemplateEditingFrame(TemplateEditingVerb verb)
        {
            ITemplateEditingService teService = (ITemplateEditingService)GetService(typeof(ITemplateEditingService));

            Trace.Assert(teService != null, "How did we get this far without an ITemplateEditingService?");
            Trace.Assert(verb.Index == 0 || verb.Index == SeparatorTemplates);

            string[] templateNames = null;
            System.Web.UI.WebControls.Style[] templateStyles = null;
            ITemplateEditingFrame             editingFrame;

            System.Web.UI.WebControls.Style[] outputTemplateStyles;

            switch (verb.Index)
            {
            case PaneTemplates:
                templateNames        = DesktopPanesDesigner.PaneTemplateNames;
                outputTemplateStyles = new Style[3];
                outputTemplateStyles[IDX_LEFT_PANE_TEMPLATE]    = desktopPanes.LeftPaneStyle;
                outputTemplateStyles[IDX_CONTENT_PANE_TEMPLATE] = desktopPanes.ControlStyle;
                outputTemplateStyles[IDX_RIGHT_PANE_TEMPLATE]   = desktopPanes.RightPaneStyle;
                templateStyles = outputTemplateStyles;
                break;

            case SeparatorTemplates:
                templateNames        = DesktopPanesDesigner.SeparatorTemplateNames;
                outputTemplateStyles = new Style[2];
                outputTemplateStyles[IDX_HORIZONTAL_SEPARATOR_TEMPLATE] = desktopPanes.HorizontalSeparatorStyle;
                outputTemplateStyles[IDX_VERTICAL_SEPARATOR_TEMPLATE]   = desktopPanes.VerticalSeparatorStyle;
                templateStyles = outputTemplateStyles;
                break;
            }
            editingFrame = teService.CreateFrame(this, verb.Text, templateNames, desktopPanes.ControlStyle, templateStyles);
            //editingFrame = teService.CreateFrame(this, verb.Text, templateNames);
            return(editingFrame);
        }