简体   繁体   English

WPF通过代码将段落添加到TableCell

[英]WPF add Paragraph into TableCell by code

How I can add two Paragraph in to TableCell by code? 如何通过代码将两个Paragraph添加到TableCell In XAML it's looks like 在XAML中,

<TableCell>
    <Paragraph>first</Paragraph>
    <Paragraph>second</Paragraph>
</TableCell>

In code I can do like this 在代码中,我可以这样

TableCell firstCell = new TableCell(new Paragraph(new Run("first")));

Try adding to the Blocks of the TableCell 尝试添加到TableCell的

Take a look at MSDN TableCell.Blocks 看看MSDN TableCell.Blocks

Ideally it would look something like this 理想情况下,它看起来像这样

//I did not test this code
TableCell firstCell = new TableCell();
firstCell.Blocks.Add(new Paragraph(new Run("first")));

Hope that was helpful! 希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM