Example #1
0
        private string GetStore()
        {
            IonItemSliding control           = this.ControlHost.Content as IonItemSliding;
            bool           bindingDataSource = false;
            StringBuilder  result            = new StringBuilder();

            if (!this.IsPreview && control.Bindings.Count > 0)
            {
                foreach (var item in control.Bindings)
                {
                    string bindPath     = item.Path == null ? "" : item.Path;
                    string bindProperty = item.Property == null ? "" : item.Property;
                    if (bindProperty.ToLower() == "datasource")
                    {
                        if (!string.IsNullOrEmpty(bindPath) && !string.IsNullOrEmpty(bindProperty))
                        {
                            result.AppendFormat("*ngFor=\"let item of {0}\"", bindPath);
                            bindingDataSource = true;
                        }
                        break;
                    }
                }
            }
            if (!this.IsPreview && control.ExistProperty("DataSource") && !bindingDataSource)
            {
                string bindPath = control.DataSource;
                if (!string.IsNullOrEmpty(bindPath))
                {
                    result.AppendFormat("*ngFor=\"let item of {0}\"", bindPath);
                }
            }
            return(result.ToString());
        }
Example #2
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            IonItemSliding control = this.ControlHost.Content as IonItemSliding;
            //Store绑定
            string store = GetStore();

            if (!string.IsNullOrEmpty(store))
            {
                this.HtmlWriter.AddAttribute(store, null);
            }
            //控件属性绑定
            string bindPropertyStr = BuildCommon.BuildControlBindProperty(control, this.ScreenDefinition, this.IsPreview);

            if (!string.IsNullOrEmpty(bindPropertyStr))
            {
                this.HtmlWriter.AddAttribute(bindPropertyStr, null);
            }

            base.SetAttributes();
        }