本文整理汇总了C#中TableCell.GetLocalValueEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.GetLocalValueEnumerator方法的具体用法?C# TableCell.GetLocalValueEnumerator怎么用?C# TableCell.GetLocalValueEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableCell
的用法示例。
在下文中一共展示了TableCell.GetLocalValueEnumerator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCellCopy
// Creates a new cell copying all its properties from a currentRow.
// RowSpan property is not copied; it's set to default value of 1.
// The new cell as added to a newRow (at the endPosition of its Cells collection).
private static TableCell AddCellCopy(TableRow newRow, TableCell currentCell, int cellInsertionIndex, bool copyRowSpan, bool copyColumnSpan)
{
Invariant.Assert(currentCell != null, "null check: currentCell");
TableCell newCell = new TableCell();
// Add the cell to a newRow's cell collection
// It's good to do it here before inserting inline formatting elements
// to avoid unnecessary TextContainer creation and content copying.
if (cellInsertionIndex < 0)
{
newRow.Cells.Add(newCell);
}
else
{
newRow.Cells.Insert(cellInsertionIndex, newCell);
}
// Copy all properties
LocalValueEnumerator properties = currentCell.GetLocalValueEnumerator();
while (properties.MoveNext())
{
LocalValueEntry propertyEntry = properties.Current;
if (propertyEntry.Property == TableCell.RowSpanProperty && !copyRowSpan ||
propertyEntry.Property == TableCell.ColumnSpanProperty && !copyColumnSpan)
{
// Skipping table structuring properties when requested
continue;
}
// Copy a property if it is not ReadOnly
if (!propertyEntry.Property.ReadOnly)
{
newCell.SetValue(propertyEntry.Property, propertyEntry.Value);
}
}
// Copy a paragraph for a cell
if (currentCell.Blocks.FirstBlock != null)
{
Paragraph newParagraph = new Paragraph();
// Transfer all known formatting properties that a locally set on a sourceBlock
Paragraph sourceParagraph = currentCell.Blocks.FirstBlock as Paragraph;
if (sourceParagraph != null)
{
DependencyProperty[] inheritableProperties = TextSchema.GetInheritableProperties(typeof(Paragraph));
DependencyProperty[] nonInheritableProperties = TextSchema.GetNoninheritableProperties(typeof(Paragraph));
for (int i = 0; i < nonInheritableProperties.Length; i++)
{
DependencyProperty property = nonInheritableProperties[i];
object value = sourceParagraph.ReadLocalValue(property);
if (value != DependencyProperty.UnsetValue)
{
newParagraph.SetValue(property, value);
}
}
for (int i = 0; i < inheritableProperties.Length; i++)
{
DependencyProperty property = inheritableProperties[i];
object value = sourceParagraph.ReadLocalValue(property);
if (value != DependencyProperty.UnsetValue)
{
newParagraph.SetValue(property, value);
}
}
}
// Add paragraph to a cell
newCell.Blocks.Add(newParagraph);
}
return newCell;
}