Esempio n. 1
0
        /// <summary>
        /// Called before the view and its children has been loaded.
        /// </summary>
        protected override void BeforeLoad()
        {
            base.BeforeLoad();

            // generate expander content and header
            if (ContentTemplates == null)
            {
                return;
            }

            foreach (var contentTemplate in ContentTemplates)
            {
                if (typeof(ExpanderContent).IsAssignableFrom(contentTemplate.TemplateType))
                {
                    var templateData = new ContentTemplateData();
                    _expanderContent = contentTemplate.Activator(templateData) as ExpanderContent;
                }
                else if (typeof(ExpanderHeader).IsAssignableFrom(contentTemplate.TemplateType))
                {
                    var templateData = new ContentTemplateData();
                    _expanderHeader = contentTemplate.Activator(templateData) as ExpanderHeader;
                }
            }

            if (_expanderHeader == null)
            {
                _expanderHeader = new DefaultExpanderHeader(this);
            }

            _expanderHeader.Alignment = HeaderAlignment;
            if (HeaderHeight != null)
            {
                _expanderHeader.Height = HeaderHeight;
            }
            _expanderHeader.ParentExpander = this;
            _expanderHeader.Text           = Text;
            _expanderHeader.Sprite         = Sprite;

            if (_expanderContent != null)
            {
                _expanderContent.Margin = ContentMargin;
            }
        }