Blocks to UIElement conversion

640 views Asked by At

Is it possible to convert a System.Windows.Documents.Block to System.Windows.UIElement?

I need this as I want to add the blocks I created to a fixed document. Is there any other way?

1

There are 1 answers

1
Cleric Stormgate On

For if someone still needs to know this, it's pretty easy.

Just use a BlockUIElement to contain the UIElement.

For instance, if you were to attach a Border element to a table's cell:

TableCell cell = new TableCell(new Border()); //won't work!

TableCell cell = new TableCell(new BlockUIContainer(new Border())); OK!