【发布时间】:2009-10-25 15:51:47
【问题描述】:
是否可以将System.Windows.Documents.Block 转换为System.Windows.UIElement?
我需要这个,因为我想将创建的块添加到固定文档中。有没有其他办法?
【问题讨论】:
标签: flowdocument uielement fixeddocument
是否可以将System.Windows.Documents.Block 转换为System.Windows.UIElement?
我需要这个,因为我想将创建的块添加到固定文档中。有没有其他办法?
【问题讨论】:
标签: flowdocument uielement fixeddocument
如果有人仍然需要知道这一点,这很容易。
只需使用 BlockUIElement 来包含 UIElement。
例如,如果您要将 Border 元素附加到表格的单元格:
TableCell 单元格 = new TableCell(new Border()); //不会工作!
TableCell cell = new TableCell(new BlockUIContainer(new Border()));好的!
【讨论】: