示例#1
0
        /// <summary>
        /// 设置Store
        /// </summary>
        /// <returns></returns>
        private string GetStore()
        {
            StringBuilder               sb = new StringBuilder();
            bool                        bindingDataSource = false;
            RadioButtonList             control           = this.ControlHost.Content as RadioButtonList;
            Dictionary <string, string> dictProperty      = control.GetPropertyBindValue();

            if (!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")
                    {
                        string property = string.Empty;
                        if (dictProperty.ContainsKey(bindProperty))
                        {
                            if (dictProperty.TryGetValue(bindProperty, out property))
                            {
                                bindProperty = property;
                            }
                        }
                        if (!string.IsNullOrEmpty(bindPath) && !string.IsNullOrEmpty(bindProperty))
                        {
                            string path = bindPath;
                            sb.AppendFormat("at('rel:{0}', '{1}').direction(1),", "", path);
                            bindingDataSource = true;
                        }
                    }
                }
            }
            if (!IsPreview && control.ExistProperty("DataSource") && !bindingDataSource)
            {
                string bindPath     = control.DataSource;
                string bindProperty = "DataSource";
                if (!string.IsNullOrEmpty(bindPath))
                {
                    string path = bindPath;
                    sb.AppendFormat("at('rel:{0}', '{1}').direction(1),", "", path);
                }
            }
            string result = sb.ToString().Length == 0 ? "" : sb.ToString().Substring(0, sb.Length - 1);

            return(result);
        }