示例#1
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            Tooltip control = this.ControlHost.Content as Tooltip;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/Tooltip");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }

            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            string[] positionList = new string[] { "before-centered", "above-centered", "after-centered", "below-centered" };
            sbProps.AppendFormat("position:['{0}'],", positionList[(int)control.Position]);
            if (control.ShowDelay != null && control.ShowDelay > 0)
            {
                sbProps.AppendFormat("showDelay:{0},", control.ShowDelay);
            }
            if (control.HideDelay != null && control.HideDelay > 0)
            {
                sbProps.AppendFormat("hideDelay:{0},", control.HideDelay);
            }
            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }

            base.SetAttributes();
        }