本文整理汇总了C#中System.Windows.Controls.Border.InvalidateArrange方法的典型用法代码示例。如果您正苦于以下问题:C# Border.InvalidateArrange方法的具体用法?C# Border.InvalidateArrange怎么用?C# Border.InvalidateArrange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Border
的用法示例。
在下文中一共展示了Border.InvalidateArrange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvalidateArrangeTest
public void InvalidateArrangeTest ()
{
Border b = new Border ();
LayoutPoker c = new LayoutPoker ();
Size s = new Size (10,10);
b.Padding = new Thickness (1,1,0,0);
b.Child = c;
b.Measure (s);
Assert.AreEqual (new Size (0,0), c.DesiredSize, "c DesiredSize");
Assert.AreEqual (new Size (9,9), c.MeasureArg, "c measure args");
Assert.AreEqual (new Size (1,1), b.DesiredSize, "b DesiredSize");
Assert.AreEqual (0,b.ActualWidth);
Assert.AreEqual (0,b.ActualHeight);
Assert.AreEqual (0,c.ActualWidth);
Assert.AreEqual (0,c.ActualHeight);
c.ArrangeResult = new Size (20,20);
b.Arrange (new Rect (0,0,10,10));
Assert.AreEqual (new Size (0,0), c.DesiredSize, "c DesiredSize");
Assert.AreEqual (new Size (20,20), c.RenderSize, "c render size");
Assert.AreEqual (new Size (9,9), c.ArrangeArg, "c measure args");
Assert.AreEqual (new Size (1,1), b.DesiredSize, "b DesiredSize");
Assert.AreEqual (new Size (10,10), b.RenderSize, "b render size");
Assert.AreEqual (new Size (10,10), new Size (b.ActualWidth, b.ActualHeight),"b actual");
Assert.AreEqual (new Size (20,20), new Size (c.ActualWidth, c.ActualHeight), "c actual");
c.ArrangeResult = new Size (9,9);
b.Arrange (new Rect (0,0,10,10));
// Does not invalidate child
b.InvalidateArrange ();
Assert.AreEqual (new Size (0,0), c.DesiredSize, "c DesiredSize");
Assert.AreEqual (new Size (20,20), c.RenderSize, "c render size");
Assert.AreEqual (new Size (9,9), c.ArrangeArg, "c measure args");
Assert.AreEqual (new Size (1,1), b.DesiredSize, "b DesiredSize");
Assert.AreEqual (new Size (10,10), b.RenderSize, "b render size");
Assert.AreEqual (new Size (10,10), new Size (b.ActualWidth, b.ActualHeight),"b actual1");
Assert.AreEqual (new Size (20,20), new Size (c.ActualWidth, c.ActualHeight), "c actual1");
c.InvalidateArrange ();
b.Arrange (new Rect (0,0,10,10));
Assert.AreEqual (new Size (0,0), c.DesiredSize, "c DesiredSize");
Assert.AreEqual (new Size (9,9), c.RenderSize, "c render size");
Assert.AreEqual (new Size (9,9), c.ArrangeArg, "c measure args");
Assert.AreEqual (new Size (1,1), b.DesiredSize, "b DesiredSize");
Assert.AreEqual (new Size (10,10), b.RenderSize, "b render size");
Assert.AreEqual (new Size (10,10), new Size (b.ActualWidth, b.ActualHeight),"b actual2");
Assert.AreEqual (new Size (9,9), new Size (c.ActualWidth, c.ActualHeight), "c actual2");
}
示例2: CustomDropDown
public CustomDropDown(Canvas anchor, Canvas drop, double _dropHeight)
{
wAnchor = new WeakReference<Canvas>(anchor);
nativePopup = new System.Windows.Controls.Primitives.Popup();
dropHeight = _dropHeight;
nativePopup.VerticalOffset = 0;
nativePopup.HorizontalOffset = 0;
drop.HorizontalAlignment = HorizontalAlignment.Left;
drop.VerticalAlignment = VerticalAlignment.Top;
nativeBorder = new Border();
nativeBorder.BorderThickness = new System.Windows.Thickness(1);
nativeBorder.Padding = new System.Windows.Thickness(5);
nativeBorder.CornerRadius = new CornerRadius(3);
nativeBorder.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 50, 50, 50));
nativeBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));
nativeBorder.VerticalAlignment = VerticalAlignment.Center;
nativeBorder.HorizontalAlignment = HorizontalAlignment.Center;
nativeBorder.Child = drop;
nativeBorder.InvalidateArrange();
Canvas canvas = new Canvas();
canvas.Width = XFPopupConst.SCREEN_WIDTH;
canvas.Height = XFPopupConst.SCREEN_HEIGHT;
canvas.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 255, 255, 255));
canvas.Tap += (c, a) => {
Hide();
};
canvas.Children.Add(nativeBorder);
nativePopup.Child = canvas;
}
示例3: BorderCallsLayoutTest
public void BorderCallsLayoutTest ()
{
var parent = new Border ();
LayoutPoker c = new LayoutPoker ();
parent.Child = c;
c.Width = 50;
c.Height = 50;
int measure_called = 0;
int arrange_called = 0;
c.Measured += (Size real) => {
c.MeasureResult = real;
measure_called++;
};
c.Arranged += (Size real) => {
c.ArrangeResult = real;
arrange_called++;
};
parent.Measure (new Size (100, 100));
Assert.AreEqual (0, arrange_called, "arrange called 0");
Assert.AreEqual (1, measure_called, "measure called 0");
Assert.AreEqual (new Size (50,50), c.DesiredSize, "c desired");
Assert.AreEqual (new Size (50,50), parent.DesiredSize, "parent desired");
parent.Arrange (new Rect (0, 0, 100, 100));
Assert.AreEqual (1, arrange_called, "arrange called 1");
Assert.AreEqual (1, measure_called, "measure called 1");
c.InvalidateMeasure ();
c.InvalidateArrange ();
parent.InvalidateArrange ();
parent.InvalidateMeasure ();
parent.Arrange (new Rect (0, 0, 100, 100));
Assert.AreEqual (2, arrange_called, "arrange called 2");
Assert.AreEqual (2, measure_called, "measure called 2");
}