开发者

Blocks to UIElement conversion

开发者 https://www.devze.com 2022-12-09 04:13 出处:网络
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 a开发者_开发百科ny other way?For

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 a开发者_开发百科ny other way?


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消