/// <summary> /// 获得运行时的样式 /// </summary> /// <param name="styleIndex"></param> /// <returns></returns> public ContentStyle GetRuntimeStyle(int styleIndex) { ContentStyle style = GetStyle(styleIndex); if (style == _Default) { return(style); } else { if (runtimeStyles == null) { runtimeStyles = new Dictionary <ContentStyle, ContentStyle>(); } if (runtimeStyles.ContainsKey(style)) { return(runtimeStyles[style]); } else { ContentStyle rs = (ContentStyle)style.Clone(); //rs.Merge(this.Default); XDependencyObject.MergeValues(this.Default, rs, false); if (string.IsNullOrEmpty(rs.DefaultValuePropertyNames) == false) { foreach (string name in rs.DefaultValuePropertyNames.Split(',')) { XDependencyObject.RemoveProperty(rs, name); }//foreach } runtimeStyles[style] = rs; return(rs); } } }