本文整理汇总了C#中System.Windows.Controls.Border.InvalidateSubtree方法的典型用法代码示例。如果您正苦于以下问题:C# Border.InvalidateSubtree方法的具体用法?C# Border.InvalidateSubtree怎么用?C# Border.InvalidateSubtree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Border
的用法示例。
在下文中一共展示了Border.InvalidateSubtree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandStarsInBorder
public void ExpandStarsInBorder ()
{
MyGrid grid = CreateGridWithChildren ();
var parent = new Border ();
parent.Child = grid;
TestPanel.Width = 75;
TestPanel.Height = 75;
CreateAsyncTest (parent,
() => {
grid.CheckRowHeights ("#1", 12, 25, 38);
grid.HorizontalAlignment = HorizontalAlignment.Left;
grid.VerticalAlignment = VerticalAlignment.Center;
parent.InvalidateSubtree ();
}, () => {
grid.CheckRowHeights ("#2", 12, 15, 15);
grid.Width = 50;
grid.Height = 50;
parent.InvalidateSubtree ();
}, () => {
grid.CheckRowHeights ("#3", 8, 17, 25);
grid.ClearValue (Grid.HorizontalAlignmentProperty);
grid.ClearValue (Grid.VerticalAlignmentProperty);
parent.InvalidateSubtree ();
}, () => {
grid.CheckRowHeights ("#4", 8, 17, 25);
}
);
}
示例2: ExpandInArrange_OutsideTree_BorderParent_FixedSize
public void ExpandInArrange_OutsideTree_BorderParent_FixedSize ()
{
// We always expand star rows if we're not in the live tree
var parent = new Border ();
// Measure with infinity and check results.
MyGrid grid = new MyGrid { Width = 200, Height = 200 };
grid.AddRows (Star);
grid.AddColumns (Star);
grid.AddChild (ContentControlWithChild (), 0, 0, 1, 1);
parent.Child = grid;
parent.InvalidateSubtree ();
parent.Measure (Infinity);
grid.CheckMeasureArgs ("#1", new Size (200, 200));
grid.CheckMeasureResult ("#2", new Size (50, 50));
Assert.AreEqual (new Size (200, 200), grid.DesiredSize, "#3");
// When we pass in the desired size as the arrange arg,
// the rows/cols use that as their height/width
parent.Arrange (new Rect (0, 0, 1000, 10000));
grid.CheckArrangeArgs ("#4", grid.DesiredSize);
grid.CheckArrangeResult ("#5", grid.DesiredSize);
grid.CheckRowHeights ("#6", grid.DesiredSize.Height);
grid.CheckColWidths ("#7", grid.DesiredSize.Width);
// If we pass in twice the desired size, the rows/cols consume that too
grid.Reset ();
parent.Arrange (new Rect (0, 0, 5, 5));
grid.CheckMeasureArgs ("#8"); // No re-measuring
grid.CheckArrangeArgs ("#9"); // No re-arranging
grid.CheckArrangeResult ("#10");
grid.CheckRowHeights ("#11", 200);
grid.CheckColWidths ("#12", 200);
// If we measure with a finite size, the rows/cols still expand
// to consume the available space
grid.Reset ();
parent.InvalidateSubtree ();
parent.Measure (new Size (1000, 1000));
grid.CheckMeasureArgs ("#13", new Size (200, 200));
grid.CheckMeasureResult ("#14", new Size (50, 50));
Assert.AreEqual (new Size (200, 200), grid.DesiredSize, "#15");
// When we pass in the desired size as the arrange arg,
// the rows/cols use that as their height/width
parent.Arrange (new Rect (0, 0, grid.DesiredSize.Width, grid.DesiredSize.Height));
grid.CheckArrangeArgs ("#16", grid.DesiredSize);
grid.CheckArrangeResult ("#17", grid.DesiredSize);
grid.CheckRowHeights ("#18", grid.DesiredSize.Height);
grid.CheckColWidths ("#19", grid.DesiredSize.Width);
}