![](/img/trans.png)
[英]Is there any meaningful difference where the Version attribute is in a PackageReference entry?
[英]Is there any meaningful use where the Paragraph.Parent property is not a FlowDocument?
在FlowDocument / WPF RichtTextBox中, Parent
屬性的類型為DependencyObject
。 但是我沒有發現任何有意義的情況,其中Parent不是FlowDocument
(或null
)。
有沒有?
編輯:
為什么我要知道那個?
我的方法將一個Paragraph
作為參數,但我不知道何時調用它。
當Parent為null
我知道該段落未集成在任何結構中。
當parent為FlowDocument
,我必須考慮到它的操作。
我是否還考慮到它可能與null
或FlowDocument
不同?
段落的文檔明確指出:
父級-在邏輯樹中獲取此元素的父級。 ( 繼承自FrameworkContentElement )
因此它是繼承的屬性,它必然具有通用的基本類型,並且對於Paragraph在合理的情況下將包含FlowDocument
對象。
不需要Paragraph.Parent FlowDocument。 在FlowDocument Table官方教程的示例中, new Paragraph(new Run("2004 Sales Project"))
的父級是TableCell
:
// Create and add an empty TableRowGroup to hold the table's Rows.
table1.RowGroups.Add(new TableRowGroup());
// Add the first (title) row.
table1.RowGroups[0].Rows.Add(new TableRow());
// Alias the current working row for easy reference.
TableRow currentRow = table1.RowGroups[0].Rows[0];
// Global formatting for the title row.
currentRow.Background = Brushes.Silver;
currentRow.FontSize = 40;
currentRow.FontWeight = System.Windows.FontWeights.Bold;
// Add the header row with content,
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("2004 Sales Project"))));
// and set the row to span all 6 columns.
currentRow.Cells[0].ColumnSpan = 6;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.