/// <summary> /// 格式化文本模板 /// </summary> /// <param name="itemTpl"></param> /// <param name="modelProcessor"></param> /// <param name="currentDataContext"></param> /// <returns></returns> private Inline CreateTextTemplateItem(TemplateItem itemTpl, IModelProcessor modelProcessor, object currentDataContext) { var content = modelProcessor.GetBindingValue(itemTpl.BindingData, currentDataContext); var text = new Run(content); var textPanel = new TextBlock(text); if (!string.IsNullOrWhiteSpace(itemTpl.FontFamily)) { textPanel.FontFamily = new Typeface(itemTpl.FontFamily).FontFamily; } if (itemTpl.Size > 0) { textPanel.FontSize = itemTpl.Size; } textPanel.TextWrapping = TextWrapping.WrapWithOverflow; textPanel.Padding = itemTpl.Padding; textPanel.Margin = itemTpl.Margin; SetControlFontStyle(itemTpl.FontStyle, textPanel); SetControlFontWeight(itemTpl.FontWeight, textPanel); var container = new InlineUIContainer(textPanel); return(container); }