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

            if (!IsPreview && control.ExistProperty("DisplayMember") && !bindingDataSource)
            {
                string bindPath     = control.DisplayMember;
                string bindProperty = "DisplayMember";
                if (!string.IsNullOrEmpty(bindPath))
                {
                    string property = string.Empty;
                    if (dictProperty.ContainsKey(bindProperty))
                    {
                        if (dictProperty.TryGetValue(bindProperty, out property))
                        {
                            bindProperty = property;
                        }
                    }
                    result.AppendFormat("'{0}'", bindPath);
                }
            }

            return(result.ToString());
        }
示例#2
0
        /// <summary>
        /// 设置Store
        /// </summary>
        /// <returns></returns>
        private string GetStore()
        {
            ChartAxisY    control                    = this.ControlHost.Content as ChartAxisY;
            StringBuilder result                     = new StringBuilder();
            bool          bindingDataSource          = false;
            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))
                        {
                            result.AppendFormat("at('rel:{0}', '{1}').direction(1)", "", bindPath);
                            if (bindProperty.ToLower() == "datasource")
                            {
                                bindingDataSource = true;
                            }
                        }
                    }
                }
            }
            if (!IsPreview && control.ExistProperty("DataSource") && !bindingDataSource)
            {
                string bindPath     = control.DataSource;
                string bindProperty = "DataSource";
                if (!string.IsNullOrEmpty(bindPath))
                {
                    string property = string.Empty;
                    if (dictProperty.ContainsKey(bindProperty))
                    {
                        if (dictProperty.TryGetValue(bindProperty, out property))
                        {
                            bindProperty = property;
                        }
                    }
                    result.AppendFormat("at('rel:{0}', '{1}').direction(1)", "", bindPath);
                }
            }

            return(result.ToString());
        }