当前位置: 首页>>代码示例>>C#>>正文


C# Border.InvalidateSubtree方法代码示例

本文整理汇总了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);
				}
			);
		}
开发者ID:dfr0,项目名称:moon,代码行数:33,代码来源:GridTestAuto.cs

示例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);
		}
开发者ID:dfr0,项目名称:moon,代码行数:53,代码来源:GridTestAuto.cs


注:本文中的System.Windows.Controls.Border.InvalidateSubtree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。