是否可以像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