本文整理汇总了C#中TableRow.Reposition方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.Reposition方法的具体用法?C# TableRow.Reposition怎么用?C# TableRow.Reposition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableRow
的用法示例。
在下文中一共展示了TableRow.Reposition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInsertionPositionInIncompleteContent
// Helper for EnsureInsertionPosition.
// Generates minimally necessary content to ensure at least one insertion position.
private static TextPointer CreateInsertionPositionInIncompleteContent(TextPointer position)
{
// Go inside the scoped element to its possible lowest level
while (position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
{
position = position.GetNextContextPosition(LogicalDirection.Forward);
}
while (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementEnd)
{
position = position.GetNextContextPosition(LogicalDirection.Backward);
}
DependencyObject parent = position.Parent;
if (parent != null)
{
if (parent is Table)
{
// Creating implicit TableRowGroup
TableRowGroup tableRowGroup = new TableRowGroup();
tableRowGroup.Reposition(position, position);
position = tableRowGroup.ContentStart;
parent = position.Parent;
}
if (parent is TableRowGroup)
{
// Creating implicit TableRow
TableRow tableRow = new TableRow();
tableRow.Reposition(position, position);
position = tableRow.ContentStart;
parent = position.Parent;
}
if (parent is TableRow)
{
// Creating implicit TableCell
TableCell tableCell = new TableCell();
tableCell.Reposition(position, position);
position = tableCell.ContentStart;
parent = position.Parent;
}
if (parent is List)
{
// Creating implicit ListItem
ListItem listItem = new ListItem();
listItem.Reposition(position, position);
position = listItem.ContentStart;
parent = position.Parent;
}
if (parent is LineBreak || parent is InlineUIContainer)
{
position = ((Inline)parent).ElementStart;
parent = position.Parent;
}
}
if (parent == null)
{
//
throw new InvalidOperationException(SR.Get(SRID.TextSchema_CannotInsertContentInThisPosition));
}
TextPointer insertionPosition;
if (TextSchema.IsValidChild(/*position:*/position, /*childType:*/typeof(Inline)))
{
insertionPosition = CreateImplicitRun(position);
}
else
{
Invariant.Assert(TextSchema.IsValidChild(/*position:*/position, /*childType:*/typeof(Block)), "Expecting valid parent-child relationship");
insertionPosition = CreateImplicitParagraph(position);
}
return insertionPosition;
}