如何创建一个允许我不断重复某些FlowDocument元素的控件。
我希望能够拥有如下所示的Xaml:
<MyCustomControl>
<Paragraph>Paragraph 1</Paragraph>
</MyCustomControl>
但让它渲染就好像它是这样的:
<Section>
<Paragraph>This is Header Text</Paragraph>
<Section> <!-- this is user area -->
<Paragraph>Paragraph 1</Paragraph>
</Section>
<Paragraph>This is Footer Text</Paragraph>
</Section>
我尝试从Section下降,并将此奖励内容放在属性
中(前面的恶劣代码)
<MyCustomControl StuffOnInside="<Paragraph>Paragraph 1</Paragraph>" />
但是当它被序列化时,它将StuffOnInside
序列化了两次,创建了重复的数据,当涉及到其他事情时又一团糟
<MyCustomControl StuffOnInside="<Paragraph>Paragraph 1</Paragraph>">
<Paragraph>This is Header Text</Paragraph>
<Section> <!-- this is user area -->
<Paragraph>Paragraph 1</Paragraph>
</Section>
<Paragraph>This is Footer Text</Paragraph>
</MyCustomControl>