Beispiel #1
0
        protected override void Draw(PageBrush brush)
        {
            var ui = (this.BelongTemplate.TemplateParent as UIElement);

            if (ui == null)
            {
                return;
            }
            var attrs = ui.Attributes;

            brush.Backspace(1); //移除 >
            XamlUtil.OutputAttributes(attrs, brush);
            brush.Draw(">");
        }
        private void OutputAttributes(StringBuilder code)
        {
            var attached = this.AttachedAttributes;
            var local    = this.Attributes;

            //先打印附加属性
            foreach (var item in attached)
            {
                var attr = item as CustomAttribute;
                if (local.GetAttribute(attr.Name) != null)
                {
                    continue;                                        //本地属性有,那么不打印,这意味着输出本地属性
                }
                XamlUtil.OutputAttribute(attr, code);
            }
            XamlUtil.OutputAttributes(local, code);
        }
Beispiel #3
0
        private void DrawBegin(PageBrush brush)
        {
            brush.Draw("<a href='javascript:;'");
            if (!string.IsNullOrEmpty(this.Color))
            {
                if (this.Outline > 0)
                {
                    brush.DrawFormat(" class='btn btn-outline-{0} m-btn", this.Color);
                }
                else
                {
                    brush.DrawFormat(" class='btn btn-{0} m-btn", this.Color);
                }
            }
            else
            {
                brush.Draw(" class='btn m-btn");
            }

            if (!string.IsNullOrEmpty(this.Hover))
            {
                brush.DrawFormat(" m-btn--hover-{0}", this.Hover);
            }

            if (!string.IsNullOrEmpty(this.Icon))
            {
                brush.Draw(" m-btn--icon");
                if (string.IsNullOrEmpty(this.Text))
                {
                    brush.Draw(" m-btn--icon-only");
                }
            }

            if (!string.IsNullOrEmpty(this.Size))
            {
                if (this.Size.EqualsIgnoreCase("custom"))
                {
                    brush.Draw(" m-btn--custom");
                }
                else
                {
                    brush.DrawFormat(" btn-{0}", this.Size);
                }
            }

            if (this.Outline > 1)
            {
                brush.DrawFormat(" m-btn--outline-{0}x", this.Outline);
            }

            if (!string.IsNullOrEmpty(this.Shape))
            {
                brush.DrawFormat(" m-btn--{0}", this.Shape);
            }

            if (this.Air)
            {
                brush.Draw(" m-btn--air");
            }

            if (!string.IsNullOrEmpty(this.Class))
            {
                brush.DrawFormat(" {0}", this.Class);
            }


            brush.Draw("' "); //class输出完毕

            XamlUtil.OutputAttributes(this.Attributes, brush);

            if (!string.IsNullOrEmpty(this.ProxyCode))
            {
                brush.DrawFormat(" data-proxy=\"{0}\" ", this.ProxyCode);
            }

            XamlUtil.OutputAttributes(this.Attributes, brush);

            brush.DrawLine(">");
        }