Ejemplo n.º 1
0
        public override void OnSetParent()
        {
            // MessageBox.Show("OnSetParent call for _ds.Site.Name=" + _ds.Site.Name + ", _ds.ID=" + _ds.ID);
            base.OnSetParent();

            Debug.Assert(_ds.Parent != null, "_ds.Parent is null");

            if (null != _parentContainer)
            {
                ParentContainerInvalid();
            }

            System.Web.UI.Control parentContainer = _ds.Parent;

            if (parentContainer is System.Web.UI.MobileControls.Panel)
            {
                _parentContainer = (System.Web.UI.MobileControls.Panel)parentContainer;
                _ds.SetOwner(_parentContainer);

                if (null != _parentContainer.DeviceSpecific &&
                    0 != String.Compare(_ds.ID, _parentContainer.DeviceSpecific.ID, StringComparison.OrdinalIgnoreCase))
                {
                    // the parent container already has a deviceSpecific child.
                    // this instance is a duplicate and needs to update its rendering.
                    // MessageBox.Show("OnSetParent - this instance is a duplicate");
                    TreatAsDuplicate(true);

                    // the current valid DeviceSpecific is intentionaly refreshed because
                    // if this deviceSpecific instance is recreated via a Undo operation
                    // the current valid DeviceSpecific appears as a duplicate if not refreshed.
                    IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
                    Debug.Assert(host != null, "Did not get a valid IDesignerHost reference");
                    IDesigner designer = host.GetDesigner((IComponent)_parentContainer.DeviceSpecific);
                    Debug.Assert(designer != null, "designer is null in DeviceSpecificDesigner");
                    DeviceSpecificDesigner dsd = (DeviceSpecificDesigner)designer;
                    dsd.UpdateRendering();
                }
                else
                {
                    // MessageBox.Show("OnSetParent - this instance becomes the valid ds");
                    _parentContainer.DeviceSpecific = _ds;
                    if (_isDuplicate)
                    {
                        TreatAsDuplicate(false);
                    }
                }
            }
            else
            {
                _parentContainer = null;
            }

            // Invalidate the type descriptor so that the PropertyOverrides
            // property browsable status gets updated
            TypeDescriptor.Refresh(Component);
        }
Ejemplo n.º 2
0
 /// <include file='doc\Panel.uex' path='docs/doc[@for="Panel.CreateDefaultTemplatedUI"]/*' />
 public override void CreateDefaultTemplatedUI(bool doDataBind)
 {
     ITemplate contentTemplate = GetTemplate(Constants.ContentTemplateTag);
     if (contentTemplate != null)
     {
         _deviceSpecificContents = new TemplateContainer();
         CheckedInstantiateTemplate (contentTemplate, _deviceSpecificContents, this);
         Controls.AddAt(0, _deviceSpecificContents);
     }
 }
Ejemplo n.º 3
0
        /// <include file='doc\Form.uex' path='docs/doc[@for="Form.CreateDefaultTemplatedUI"]/*' />
        public override void CreateDefaultTemplatedUI(bool doDataBind) 
        {
            ITemplate headerTemplate = GetTemplate(Constants.HeaderTemplateTag);
            ITemplate footerTemplate = GetTemplate(Constants.FooterTemplateTag);
            ITemplate scriptTemplate = GetTemplate(Constants.ScriptTemplateTag);

            if (scriptTemplate != null)
            {
                _scriptContainer = new TemplateContainer();
                // The scriptTemplate is not added to the controls tree, so no need to do
                // CheckedInstantiateTemplate to check for infinite recursion.
                scriptTemplate.InstantiateIn(_scriptContainer);
                _scriptContainer.EnablePagination = false;
            }

            if (headerTemplate != null)
            {
                _headerContainer = new TemplateContainer();
                CheckedInstantiateTemplate (headerTemplate, _headerContainer, this);
                _headerContainer.EnablePagination = false;
                Controls.AddAt(0, _headerContainer);
            }
            
            if (footerTemplate != null)
            {
                _footerContainer = new TemplateContainer();
                CheckedInstantiateTemplate (footerTemplate, _footerContainer, this);
                _footerContainer.EnablePagination = false;
                Controls.Add(_footerContainer);
            }

            // Do not call base.CreateDefaultTemplatedUI(), since we don't want
            // Forms to have ContentTemplates as Panels do.
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Initializes the designer with the Form control that this instance
        ///   of the designer is associated with.
        /// </summary>
        /// <param name='component'>
        ///   The associated Form control.
        /// </param>
        /// <seealso cref='IDesigner'/>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component is Panel,
                "PanelDesigner.Initialize - Invalid Panel Control");

            // This must be called first in order to get properties from runtime control.
            base.Initialize(component);

            _panel = (Panel) component;

            SystemEvents.UserPreferenceChanged += 
                new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
        }
        public override void OnSetParent() 
        {
            // MessageBox.Show("OnSetParent call for _ds.Site.Name=" + _ds.Site.Name + ", _ds.ID=" + _ds.ID);
            base.OnSetParent();

            Debug.Assert(_ds.Parent != null, "_ds.Parent is null");

            if (null != _parentContainer)
            {
                ParentContainerInvalid();
            }

            System.Web.UI.Control parentContainer = _ds.Parent;

            if (parentContainer is System.Web.UI.MobileControls.Panel)
            {
                _parentContainer = (System.Web.UI.MobileControls.Panel) parentContainer;
                _ds.SetOwner(_parentContainer);

                if (null != _parentContainer.DeviceSpecific &&
                    0 != String.Compare(_ds.ID, _parentContainer.DeviceSpecific.ID, StringComparison.OrdinalIgnoreCase))
                {
                    // the parent container already has a deviceSpecific child.
                    // this instance is a duplicate and needs to update its rendering.
                    // MessageBox.Show("OnSetParent - this instance is a duplicate");
                    TreatAsDuplicate(true);

                    // the current valid DeviceSpecific is intentionaly refreshed because
                    // if this deviceSpecific instance is recreated via a Undo operation
                    // the current valid DeviceSpecific appears as a duplicate if not refreshed.
                    IDesignerHost host = (IDesignerHost) GetService(typeof(IDesignerHost));
                    Debug.Assert(host != null, "Did not get a valid IDesignerHost reference");
                    IDesigner designer = host.GetDesigner((IComponent) _parentContainer.DeviceSpecific);
                    Debug.Assert(designer != null, "designer is null in DeviceSpecificDesigner");
                    DeviceSpecificDesigner dsd = (DeviceSpecificDesigner) designer;
                    dsd.UpdateRendering();
                }
                else
                {
                    // MessageBox.Show("OnSetParent - this instance becomes the valid ds");
                    _parentContainer.DeviceSpecific = _ds;
                    if (_isDuplicate)
                    {
                        TreatAsDuplicate(false);
                    }
                }
            }
            else
            {
                _parentContainer = null;
            }

            // Invalidate the type descriptor so that the PropertyOverrides
            // property browsable status gets updated
            TypeDescriptor.Refresh(Component);
        }
Ejemplo n.º 6
0
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     this._panel = (Panel) component;
     SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
 }