是否可以像Paragraph.Inline元素一样清除所有属性(如背景颜色...),就像使用类TextRange一样?如何清除段落中的所有属性。inline
那么,我想清除从以前的运行元素Inline集合背景propery。所以我觉得调用一个可以清除以前所有属性的方法会更容易。 然而,在我的情况,似乎要做到这一点是这样的唯一途径:
int index = 0;
...
List<Inline> runList = ParagraphComponent.Inlines.ToList();
if (index < runList.Count) {
if (index > 1) {
int previousPartIndex = index - 2;
if (!string.IsNullOrEmpty(runList[previousPartIndex].Text)) {
runList[previousPartIndex].Background = null;
}
}
runList[index].Background = BackgroundColor;
index += 2;
}
[你尝试过什么?](http://mattgemmell.com/what-have-you-tried/) – Clemens
克莱门斯嗨!请检查编辑后!附:这只是我复杂的东西,或FlowDocument,Inline组件requries一些练习时间或它真的很复杂? – Kapparino