public void OffsetInScrollViewerCanContentScrollInWindowWithChildren() { Window w = new Window(); ScrollViewer v = new ScrollViewer(); w.Content = v; w.Show(); v.CanContentScroll = true; StackPanel p = new StackPanel(); w.Width = 100; w.Height = 100; for (int i = 0; i < 10; i++) { global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); b.Content = "Test"; p.Children.Add(b); } v.Content = p; Assert.AreEqual(p.HorizontalOffset, 0, "1"); Assert.AreEqual(p.VerticalOffset, 0, "2"); p.SetHorizontalOffset(1); Assert.AreEqual(p.HorizontalOffset, 0, "3"); p.SetVerticalOffset(1); Assert.AreEqual(p.VerticalOffset, 0, "4"); p.SetHorizontalOffset(-1); Assert.AreEqual(p.HorizontalOffset, 0, "5"); p.SetVerticalOffset(-1); Assert.AreEqual(p.VerticalOffset, 0, "6"); }
public void NotInScrollViewer() { Window window = new Window(); StackPanel stack_panel = new StackPanel(); window.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button(); stack_panel.Children.Add(button); window.Show(); Assert.AreEqual(button.ActualWidth, stack_panel.ActualWidth); }
public void GridAttachedPropertiesOutOfRange() { Grid g = new Grid(); g.RowDefinitions.Add(new RowDefinition()); global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); Grid.SetRow(b, 5); g.Children.Add(b); g.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); g.Arrange(new Rect(0, 0, 100, 100)); }
public ArrangeGrid() { global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); Children.Add(b); RowDefinitions.Add(new RowDefinition()); Window w = new Window(); w.Content = this; w.Show(); w.Height = 0; Assert.AreEqual(ArrangeFinalSize.Height, 0); }
public void MakeVisible() { StackPanel p = new StackPanel(); Rect result = p.MakeVisible(null, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "1 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "1"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "2"); result = p.MakeVisible(null, new Rect(100, 100, 100, 100)); Assert.AreEqual(p.VerticalOffset, 0, "3 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "3"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "4"); global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); p.Children.Add(b); result = p.MakeVisible(b, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "5 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "5"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "6"); ScrollViewer v = new ScrollViewer(); v.Content = p; result = p.MakeVisible(null, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "7 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "7"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "8"); result = p.MakeVisible(b, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "9 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "9"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "10"); v.CanContentScroll = true; result = p.MakeVisible(null, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "11 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "11"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "12"); result = p.MakeVisible(b, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "13 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "13"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "14"); Window w = new Window(); w.Content = v; w.Show(); result = p.MakeVisible(null, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "15 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "15"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "16"); result = p.MakeVisible(b, Rect.Empty); Assert.AreEqual(p.VerticalOffset, 0, "17 1"); Assert.IsTrue(double.IsNegativeInfinity(result.Width), "17"); Assert.IsTrue(double.IsNegativeInfinity(result.Height), "18"); }
public void Button() { Grid g = new Grid(); g.RowDefinitions.Add(new RowDefinition()); global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); g.Children.Add(b); g.Measure(new Size(Utility.GetEmptyButtonSize() / 2, Utility.GetEmptyButtonSize() / 2)); g.Arrange(new Rect(0, 0, Utility.GetEmptyButtonSize() / 2, Utility.GetEmptyButtonSize() / 2)); Assert.AreEqual(b.DesiredSize.Width, 0, "1"); Assert.AreEqual(b.DesiredSize.Height, 0, "2"); Assert.AreEqual(b.ActualWidth, Utility.GetEmptyButtonSize() / 2, "3"); Assert.AreEqual(b.ActualHeight, Utility.GetEmptyButtonSize() / 2, "4"); }
public void ExtentSimple() { Window w = new Window(); ScrollViewer v = new ScrollViewer(); w.Content = v; StackPanel p = new StackPanel(); v.Content = p; global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); p.Children.Add(b); w.Show(); Assert.AreEqual(p.ExtentWidth, 0, "1"); Assert.AreEqual(p.ExtentHeight, 0, "2"); }
public void InScrollViewerCanContentScroll() { Window window = new Window(); ScrollViewer scroll_viewer = new ScrollViewer(); scroll_viewer.CanContentScroll = true; window.Content = scroll_viewer; StackPanel stack_panel = new StackPanel(); scroll_viewer.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button(); stack_panel.Children.Add(button); window.Show(); Assert.AreEqual(button.ActualWidth, scroll_viewer.ViewportWidth, "1"); Assert.AreEqual(button.ActualWidth, stack_panel.ActualWidth, "2"); }
public ChangingDefinitionsCauseMeasureChildren3Grid() { Window w = new Window(); w.Content = this; w.Show(); global::System.Windows.Controls.Button b1 = new global::System.Windows.Controls.Button(); Children.Add(b1); global::System.Windows.Controls.Button b2 = new global::System.Windows.Controls.Button(); Grid.SetColumn(b2, 1); Children.Add(b2); set_called = true; RowDefinitions.Add(new RowDefinition()); RowDefinitions.Add(new RowDefinition()); ColumnDefinitions.Add(new ColumnDefinition()); Assert.IsFalse(called); }
public MeasureConstraintAutoGrid() { RowDefinitions.Add(new RowDefinition()); RowDefinition row_definition = new RowDefinition(); row_definition.Height = new GridLength(1, GridUnitType.Star); RowDefinitions.Add(row_definition); global::System.Windows.Controls.Button button1 = new global::System.Windows.Controls.Button(); Children.Add(button1); TestButton button2 = new TestButton(); Grid.SetRow(button2, 1); Children.Add(button2); Window window = new Window(); window.Content = this; window.Show(); Assert.AreEqual(measure_constraint.Height, ActualHeight / 2); }
public void SizeInScrollViewer() { Window window = new Window(); ScrollViewer scroll_viewer = new ScrollViewer(); window.Content = scroll_viewer; SizeInScrollViewerStackPanel stack_panel = new SizeInScrollViewerStackPanel(); scroll_viewer.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button(); stack_panel.Children.Add(button); window.Show(); Assert.AreEqual(stack_panel.ActualWidth, scroll_viewer.ViewportWidth, "1"); Assert.AreEqual(stack_panel.ActualHeight, scroll_viewer.ViewportHeight, "2"); Assert.AreEqual(stack_panel.DesiredSize.Width, Utility.GetEmptyButtonSize(), "3"); Assert.AreEqual(stack_panel.DesiredSize.Height, Utility.GetEmptyButtonSize(), "4"); Assert.AreEqual(stack_panel.MeasureResult.Width, Utility.GetEmptyButtonSize(), "5"); Assert.AreEqual(stack_panel.MeasureResult.Height, Utility.GetEmptyButtonSize(), "6"); }
public void StarSizing() { Grid g = new Grid(); ColumnDefinition c1 = new ColumnDefinition(); g.ColumnDefinitions.Add(c1); ColumnDefinition c2 = new ColumnDefinition(); g.ColumnDefinitions.Add(c2); global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); g.Children.Add(b); Canvas c = new Canvas(); c.Children.Add(g); Window w = new Window(); w.Content = c; w.Show(); Assert.AreEqual(c1.ActualWidth, Utility.GetEmptyButtonSize(), "1"); Assert.AreEqual(c2.ActualWidth, 0, "2"); }
public void ExtentSimpleCanContentScroll() { Window w = new Window(); ScrollViewer v = new ScrollViewer(); v.CanContentScroll = true; w.Content = v; StackPanel p = new StackPanel(); v.Content = p; global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button(); p.Children.Add(b); w.Show(); Assert.AreEqual(p.ExtentWidth, Utility.GetEmptyButtonSize(), "1"); Assert.AreEqual(p.ExtentHeight, 1, "2"); p.Orientation = Orientation.Horizontal; Assert.AreEqual(p.ExtentWidth, 0, "3"); Assert.AreEqual(p.ExtentHeight, 0, "4"); w.Hide(); w.Show(); Assert.AreEqual(p.ExtentWidth, 0, "5"); Assert.AreEqual(p.ExtentHeight, 0, "6"); }
public void ExtentSimpleCanContentScrollHorizontal () { Window w = new Window (); ScrollViewer v = new ScrollViewer (); v.CanContentScroll = true; w.Content = v; StackPanel p = new StackPanel (); p.Orientation = Orientation.Horizontal; v.Content = p; global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button (); p.Children.Add (b); w.Show (); Assert.AreEqual (p.ExtentWidth, 1, "1"); Assert.AreEqual (p.ExtentHeight, Utility.GetEmptyButtonSize (), "2"); p.Orientation = Orientation.Vertical; Assert.AreEqual (p.ExtentWidth, 0, "3"); Assert.AreEqual (p.ExtentHeight, 0, "4"); w.Hide (); w.Show (); Assert.AreEqual (p.ExtentWidth, 0, "5"); Assert.AreEqual (p.ExtentHeight, 0, "6"); }
private static global::System.Windows.TemplateInstance Instantiate_ControlTemplate_774828d401f24f19ae1284661393c433(global::System.Windows.FrameworkElement templateOwner) { var templateInstance_342dda018fca426091c96e0702ac85fb = new global::System.Windows.TemplateInstance(); templateInstance_342dda018fca426091c96e0702ac85fb.TemplateOwner = templateOwner; var Grid_d2c5f67656be49198b6e3efcfc9cc0d2 = new global::System.Windows.Controls.Grid(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Root", Grid_d2c5f67656be49198b6e3efcfc9cc0d2); Grid_d2c5f67656be49198b6e3efcfc9cc0d2.Name = "Root"; var ColumnDefinition_ddc4243eeb7f4fd18e920ded79e45556 = new global::System.Windows.Controls.ColumnDefinition(); ColumnDefinition_ddc4243eeb7f4fd18e920ded79e45556.Width = (global::System.Windows.GridLength)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.GridLength), @"*"); var ColumnDefinition_4e2f238f21944fc592e92958b03da088 = new global::System.Windows.Controls.ColumnDefinition(); ColumnDefinition_4e2f238f21944fc592e92958b03da088.Width = (global::System.Windows.GridLength)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.GridLength), @"Auto"); Grid_d2c5f67656be49198b6e3efcfc9cc0d2.ColumnDefinitions.Add(ColumnDefinition_ddc4243eeb7f4fd18e920ded79e45556); Grid_d2c5f67656be49198b6e3efcfc9cc0d2.ColumnDefinitions.Add(ColumnDefinition_4e2f238f21944fc592e92958b03da088); var TextBox_0a7e5081c37049afb9e46a1ac2fe362e = new global::System.Windows.Controls.TextBox(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("TextBox", TextBox_0a7e5081c37049afb9e46a1ac2fe362e); TextBox_0a7e5081c37049afb9e46a1ac2fe362e.Name = "TextBox"; global::System.Windows.Controls.Grid.SetColumn(TextBox_0a7e5081c37049afb9e46a1ac2fe362e, (global::System.Int32)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Int32), @"0")); var Binding_eb3d83ca7da44eb18c9db7e502c3b63a = new global::System.Windows.Data.Binding(); Binding_eb3d83ca7da44eb18c9db7e502c3b63a.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Background"); var RelativeSource_323ad6d163484146883d96cb9cc2eb9e = new global::System.Windows.Data.RelativeSource(); RelativeSource_323ad6d163484146883d96cb9cc2eb9e.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_eb3d83ca7da44eb18c9db7e502c3b63a.RelativeSource = RelativeSource_323ad6d163484146883d96cb9cc2eb9e; Binding_eb3d83ca7da44eb18c9db7e502c3b63a.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Binding_4c9a4ab572414c8ea08d360bbb994c8d = new global::System.Windows.Data.Binding(); Binding_4c9a4ab572414c8ea08d360bbb994c8d.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderBrush"); var RelativeSource_08803430b3334fb6860652dcecfd229b = new global::System.Windows.Data.RelativeSource(); RelativeSource_08803430b3334fb6860652dcecfd229b.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_4c9a4ab572414c8ea08d360bbb994c8d.RelativeSource = RelativeSource_08803430b3334fb6860652dcecfd229b; Binding_4c9a4ab572414c8ea08d360bbb994c8d.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Binding_19f0d877cb1f46b9ba5b51e587a8a91f = new global::System.Windows.Data.Binding(); Binding_19f0d877cb1f46b9ba5b51e587a8a91f.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderThickness"); var RelativeSource_4da5f4bc2a4240c5b3d0b9c0218eba0a = new global::System.Windows.Data.RelativeSource(); RelativeSource_4da5f4bc2a4240c5b3d0b9c0218eba0a.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_19f0d877cb1f46b9ba5b51e587a8a91f.RelativeSource = RelativeSource_4da5f4bc2a4240c5b3d0b9c0218eba0a; Binding_19f0d877cb1f46b9ba5b51e587a8a91f.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Binding_9a36a78445064710ab65f1d658bf125b = new global::System.Windows.Data.Binding(); Binding_9a36a78445064710ab65f1d658bf125b.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Padding"); var RelativeSource_0cdb916f603946958c43864dd854b034 = new global::System.Windows.Data.RelativeSource(); RelativeSource_0cdb916f603946958c43864dd854b034.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_9a36a78445064710ab65f1d658bf125b.RelativeSource = RelativeSource_0cdb916f603946958c43864dd854b034; Binding_9a36a78445064710ab65f1d658bf125b.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Button_8764eb0dba1f477a89ef2fce3ec219de = new global::System.Windows.Controls.Button(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Button", Button_8764eb0dba1f477a89ef2fce3ec219de); Button_8764eb0dba1f477a89ef2fce3ec219de.Name = "Button"; global::System.Windows.Controls.Grid.SetColumn(Button_8764eb0dba1f477a89ef2fce3ec219de, (global::System.Int32)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Int32), @"1")); Button_8764eb0dba1f477a89ef2fce3ec219de.Content = (global::System.Object)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Object), @"▼"); Button_8764eb0dba1f477a89ef2fce3ec219de.Width = (global::System.Double)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Double), @"30"); Button_8764eb0dba1f477a89ef2fce3ec219de.Margin = (global::System.Windows.Thickness)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.Thickness), @"2,0,2,0"); var Binding_9bdb992db4ca466bbc8e2934d73a9d36 = new global::System.Windows.Data.Binding(); Binding_9bdb992db4ca466bbc8e2934d73a9d36.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Foreground"); var RelativeSource_4601b43081ef4624818772ad158addf4 = new global::System.Windows.Data.RelativeSource(); RelativeSource_4601b43081ef4624818772ad158addf4.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_9bdb992db4ca466bbc8e2934d73a9d36.RelativeSource = RelativeSource_4601b43081ef4624818772ad158addf4; Binding_9bdb992db4ca466bbc8e2934d73a9d36.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Binding_53f6accb6bee4d689a7ffd667aaa847a = new global::System.Windows.Data.Binding(); Binding_53f6accb6bee4d689a7ffd667aaa847a.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderBrush"); var RelativeSource_475062fdac094166a83ecc21e5476083 = new global::System.Windows.Data.RelativeSource(); RelativeSource_475062fdac094166a83ecc21e5476083.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_53f6accb6bee4d689a7ffd667aaa847a.RelativeSource = RelativeSource_475062fdac094166a83ecc21e5476083; Binding_53f6accb6bee4d689a7ffd667aaa847a.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Binding_69533b84f62846bf917e1fa02dede28a = new global::System.Windows.Data.Binding(); Binding_69533b84f62846bf917e1fa02dede28a.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderThickness"); var RelativeSource_7a862635a2824423b9375dbcca95d183 = new global::System.Windows.Data.RelativeSource(); RelativeSource_7a862635a2824423b9375dbcca95d183.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_69533b84f62846bf917e1fa02dede28a.RelativeSource = RelativeSource_7a862635a2824423b9375dbcca95d183; Binding_69533b84f62846bf917e1fa02dede28a.TemplateOwner = templateInstance_342dda018fca426091c96e0702ac85fb; var Popup_1a590b878d2d4275850bbfd54ef47c0d = new global::System.Windows.Controls.Primitives.Popup(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Popup", Popup_1a590b878d2d4275850bbfd54ef47c0d); Popup_1a590b878d2d4275850bbfd54ef47c0d.Name = "Popup"; Popup_1a590b878d2d4275850bbfd54ef47c0d.VerticalAlignment = global::System.Windows.VerticalAlignment.Bottom; Grid_d2c5f67656be49198b6e3efcfc9cc0d2.Children.Add(TextBox_0a7e5081c37049afb9e46a1ac2fe362e); Grid_d2c5f67656be49198b6e3efcfc9cc0d2.Children.Add(Button_8764eb0dba1f477a89ef2fce3ec219de); Grid_d2c5f67656be49198b6e3efcfc9cc0d2.Children.Add(Popup_1a590b878d2d4275850bbfd54ef47c0d); TextBox_0a7e5081c37049afb9e46a1ac2fe362e.SetBinding(global::System.Windows.Controls.Control.BackgroundProperty, Binding_eb3d83ca7da44eb18c9db7e502c3b63a); TextBox_0a7e5081c37049afb9e46a1ac2fe362e.SetBinding(global::System.Windows.Controls.Control.BorderBrushProperty, Binding_4c9a4ab572414c8ea08d360bbb994c8d); TextBox_0a7e5081c37049afb9e46a1ac2fe362e.SetBinding(global::System.Windows.Controls.Control.BorderThicknessProperty, Binding_19f0d877cb1f46b9ba5b51e587a8a91f); TextBox_0a7e5081c37049afb9e46a1ac2fe362e.SetBinding(global::System.Windows.Controls.Control.PaddingProperty, Binding_9a36a78445064710ab65f1d658bf125b); Button_8764eb0dba1f477a89ef2fce3ec219de.SetBinding(global::System.Windows.Controls.Control.ForegroundProperty, Binding_9bdb992db4ca466bbc8e2934d73a9d36); Button_8764eb0dba1f477a89ef2fce3ec219de.SetBinding(global::System.Windows.Controls.Control.BorderBrushProperty, Binding_53f6accb6bee4d689a7ffd667aaa847a); Button_8764eb0dba1f477a89ef2fce3ec219de.SetBinding(global::System.Windows.Controls.Control.BorderThicknessProperty, Binding_69533b84f62846bf917e1fa02dede28a); templateInstance_342dda018fca426091c96e0702ac85fb.TemplateContent = Grid_d2c5f67656be49198b6e3efcfc9cc0d2; return(templateInstance_342dda018fca426091c96e0702ac85fb); }
public void MakeVisible () { StackPanel p = new StackPanel (); Rect result = p.MakeVisible (null, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "1 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "1"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "2"); result = p.MakeVisible (null, new Rect (100, 100, 100, 100)); Assert.AreEqual (p.VerticalOffset, 0, "3 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "3"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "4"); global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button (); p.Children.Add (b); result = p.MakeVisible (b, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "5 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "5"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "6"); ScrollViewer v = new ScrollViewer (); v.Content = p; result = p.MakeVisible (null, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "7 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "7"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "8"); result = p.MakeVisible (b, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "9 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "9"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "10"); v.CanContentScroll = true; result = p.MakeVisible (null, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "11 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "11"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "12"); result = p.MakeVisible (b, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "13 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "13"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "14"); Window w = new Window (); w.Content = v; w.Show (); result = p.MakeVisible (null, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "15 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "15"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "16"); result = p.MakeVisible (b, Rect.Empty); Assert.AreEqual (p.VerticalOffset, 0, "17 1"); Assert.IsTrue (double.IsNegativeInfinity (result.Width), "17"); Assert.IsTrue (double.IsNegativeInfinity (result.Height), "18"); }
private static global::System.Windows.TemplateInstance Instantiate_ControlTemplate_2edd8eda64044039bbbb3e6198beb231(global::System.Windows.FrameworkElement templateOwner) { var templateInstance_e63a3324cd3840b8bb6a590db0a94283 = new global::System.Windows.TemplateInstance(); templateInstance_e63a3324cd3840b8bb6a590db0a94283.TemplateOwner = templateOwner; var Grid_83fdab7a48894fd18f82be1c873d4679 = new global::System.Windows.Controls.Grid(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Root", Grid_83fdab7a48894fd18f82be1c873d4679); Grid_83fdab7a48894fd18f82be1c873d4679.Name = "Root"; var ColumnDefinition_40e1206d34ca4895abfe888b8af328dc = new global::System.Windows.Controls.ColumnDefinition(); ColumnDefinition_40e1206d34ca4895abfe888b8af328dc.Width = (global::System.Windows.GridLength)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.GridLength), @"*"); var ColumnDefinition_527f5ebe8b8a487083fa30b3655a5eb4 = new global::System.Windows.Controls.ColumnDefinition(); ColumnDefinition_527f5ebe8b8a487083fa30b3655a5eb4.Width = (global::System.Windows.GridLength)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.GridLength), @"Auto"); Grid_83fdab7a48894fd18f82be1c873d4679.ColumnDefinitions.Add(ColumnDefinition_40e1206d34ca4895abfe888b8af328dc); Grid_83fdab7a48894fd18f82be1c873d4679.ColumnDefinitions.Add(ColumnDefinition_527f5ebe8b8a487083fa30b3655a5eb4); var TextBox_e8ad548eda0047e9a6f219e5890ad050 = new global::System.Windows.Controls.TextBox(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("TextBox", TextBox_e8ad548eda0047e9a6f219e5890ad050); TextBox_e8ad548eda0047e9a6f219e5890ad050.Name = "TextBox"; global::System.Windows.Controls.Grid.SetColumn(TextBox_e8ad548eda0047e9a6f219e5890ad050, (global::System.Int32)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Int32), @"0")); var Binding_9bfb5d7cf4aa44ac854b34116f9b6d66 = new global::System.Windows.Data.Binding(); Binding_9bfb5d7cf4aa44ac854b34116f9b6d66.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Background"); var RelativeSource_f4ee9cb21d2a4eb1bc400b2c26fd0dcc = new global::System.Windows.Data.RelativeSource(); RelativeSource_f4ee9cb21d2a4eb1bc400b2c26fd0dcc.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_9bfb5d7cf4aa44ac854b34116f9b6d66.RelativeSource = RelativeSource_f4ee9cb21d2a4eb1bc400b2c26fd0dcc; Binding_9bfb5d7cf4aa44ac854b34116f9b6d66.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Binding_c7b34b15a8fd4ff4acf94b73893e4529 = new global::System.Windows.Data.Binding(); Binding_c7b34b15a8fd4ff4acf94b73893e4529.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderBrush"); var RelativeSource_adefd8da691644fcabf12ad850c9e6a9 = new global::System.Windows.Data.RelativeSource(); RelativeSource_adefd8da691644fcabf12ad850c9e6a9.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_c7b34b15a8fd4ff4acf94b73893e4529.RelativeSource = RelativeSource_adefd8da691644fcabf12ad850c9e6a9; Binding_c7b34b15a8fd4ff4acf94b73893e4529.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Binding_b7b85e330b574a7ead3934864e6aef11 = new global::System.Windows.Data.Binding(); Binding_b7b85e330b574a7ead3934864e6aef11.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderThickness"); var RelativeSource_64d04ff10418401993520dd22b42ddbd = new global::System.Windows.Data.RelativeSource(); RelativeSource_64d04ff10418401993520dd22b42ddbd.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_b7b85e330b574a7ead3934864e6aef11.RelativeSource = RelativeSource_64d04ff10418401993520dd22b42ddbd; Binding_b7b85e330b574a7ead3934864e6aef11.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Binding_2ba4d05177cf40298950abe15a9ae41e = new global::System.Windows.Data.Binding(); Binding_2ba4d05177cf40298950abe15a9ae41e.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Padding"); var RelativeSource_6d1393c985644dea9ce7a991de1f4f55 = new global::System.Windows.Data.RelativeSource(); RelativeSource_6d1393c985644dea9ce7a991de1f4f55.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_2ba4d05177cf40298950abe15a9ae41e.RelativeSource = RelativeSource_6d1393c985644dea9ce7a991de1f4f55; Binding_2ba4d05177cf40298950abe15a9ae41e.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Button_98e020b5b2e247c4a65dde2bcf95be2e = new global::System.Windows.Controls.Button(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Button", Button_98e020b5b2e247c4a65dde2bcf95be2e); Button_98e020b5b2e247c4a65dde2bcf95be2e.Name = "Button"; global::System.Windows.Controls.Grid.SetColumn(Button_98e020b5b2e247c4a65dde2bcf95be2e, (global::System.Int32)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Int32), @"1")); Button_98e020b5b2e247c4a65dde2bcf95be2e.Content = (global::System.Object)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Object), @"▼"); Button_98e020b5b2e247c4a65dde2bcf95be2e.Width = (global::System.Double)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Double), @"30"); Button_98e020b5b2e247c4a65dde2bcf95be2e.Margin = (global::System.Windows.Thickness)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.Thickness), @"2,0,2,0"); var Binding_fcba859302854aab9b9c439d2e871267 = new global::System.Windows.Data.Binding(); Binding_fcba859302854aab9b9c439d2e871267.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"Foreground"); var RelativeSource_8013d701695b46ad94dd5d59e00a2cb0 = new global::System.Windows.Data.RelativeSource(); RelativeSource_8013d701695b46ad94dd5d59e00a2cb0.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_fcba859302854aab9b9c439d2e871267.RelativeSource = RelativeSource_8013d701695b46ad94dd5d59e00a2cb0; Binding_fcba859302854aab9b9c439d2e871267.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Binding_9df19b0897774b359d6300faa9e11666 = new global::System.Windows.Data.Binding(); Binding_9df19b0897774b359d6300faa9e11666.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderBrush"); var RelativeSource_e7ff9ba4dbf841fa948dc73a29d77a53 = new global::System.Windows.Data.RelativeSource(); RelativeSource_e7ff9ba4dbf841fa948dc73a29d77a53.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_9df19b0897774b359d6300faa9e11666.RelativeSource = RelativeSource_e7ff9ba4dbf841fa948dc73a29d77a53; Binding_9df19b0897774b359d6300faa9e11666.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Binding_60e905380dcb41449831e462e6f80c83 = new global::System.Windows.Data.Binding(); Binding_60e905380dcb41449831e462e6f80c83.Path = (global::System.Windows.PropertyPath)global::DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(typeof(global::System.Windows.PropertyPath), @"BorderThickness"); var RelativeSource_8d6049fc3c4147bdb7282c50459d6651 = new global::System.Windows.Data.RelativeSource(); RelativeSource_8d6049fc3c4147bdb7282c50459d6651.Mode = global::System.Windows.Data.RelativeSourceMode.TemplatedParent; Binding_60e905380dcb41449831e462e6f80c83.RelativeSource = RelativeSource_8d6049fc3c4147bdb7282c50459d6651; Binding_60e905380dcb41449831e462e6f80c83.TemplateOwner = templateInstance_e63a3324cd3840b8bb6a590db0a94283; var Popup_178cd792b23d46ccbcf76958fd333e1d = new global::System.Windows.Controls.Primitives.Popup(); ((global::System.Windows.Controls.Control)templateOwner).RegisterName("Popup", Popup_178cd792b23d46ccbcf76958fd333e1d); Popup_178cd792b23d46ccbcf76958fd333e1d.Name = "Popup"; Popup_178cd792b23d46ccbcf76958fd333e1d.VerticalAlignment = global::System.Windows.VerticalAlignment.Bottom; Grid_83fdab7a48894fd18f82be1c873d4679.Children.Add(TextBox_e8ad548eda0047e9a6f219e5890ad050); Grid_83fdab7a48894fd18f82be1c873d4679.Children.Add(Button_98e020b5b2e247c4a65dde2bcf95be2e); Grid_83fdab7a48894fd18f82be1c873d4679.Children.Add(Popup_178cd792b23d46ccbcf76958fd333e1d); TextBox_e8ad548eda0047e9a6f219e5890ad050.SetBinding(global::System.Windows.Controls.Control.BackgroundProperty, Binding_9bfb5d7cf4aa44ac854b34116f9b6d66); TextBox_e8ad548eda0047e9a6f219e5890ad050.SetBinding(global::System.Windows.Controls.Control.BorderBrushProperty, Binding_c7b34b15a8fd4ff4acf94b73893e4529); TextBox_e8ad548eda0047e9a6f219e5890ad050.SetBinding(global::System.Windows.Controls.Control.BorderThicknessProperty, Binding_b7b85e330b574a7ead3934864e6aef11); TextBox_e8ad548eda0047e9a6f219e5890ad050.SetBinding(global::System.Windows.Controls.Control.PaddingProperty, Binding_2ba4d05177cf40298950abe15a9ae41e); Button_98e020b5b2e247c4a65dde2bcf95be2e.SetBinding(global::System.Windows.Controls.Control.ForegroundProperty, Binding_fcba859302854aab9b9c439d2e871267); Button_98e020b5b2e247c4a65dde2bcf95be2e.SetBinding(global::System.Windows.Controls.Control.BorderBrushProperty, Binding_9df19b0897774b359d6300faa9e11666); Button_98e020b5b2e247c4a65dde2bcf95be2e.SetBinding(global::System.Windows.Controls.Control.BorderThicknessProperty, Binding_60e905380dcb41449831e462e6f80c83); templateInstance_e63a3324cd3840b8bb6a590db0a94283.TemplateContent = Grid_83fdab7a48894fd18f82be1c873d4679; return(templateInstance_e63a3324cd3840b8bb6a590db0a94283); }
public void OffsetInScrollViewerCanContentScrollInWindowWithChildren () { Window w = new Window (); ScrollViewer v = new ScrollViewer (); w.Content = v; w.Show (); v.CanContentScroll = true; StackPanel p = new StackPanel (); w.Width = 100; w.Height = 100; for (int i = 0; i < 10; i++) { global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button (); b.Content = "Test"; p.Children.Add (b); } v.Content = p; Assert.AreEqual (p.HorizontalOffset, 0, "1"); Assert.AreEqual (p.VerticalOffset, 0, "2"); p.SetHorizontalOffset (1); Assert.AreEqual (p.HorizontalOffset, 0, "3"); p.SetVerticalOffset (1); Assert.AreEqual (p.VerticalOffset, 0, "4"); p.SetHorizontalOffset (-1); Assert.AreEqual (p.HorizontalOffset, 0, "5"); p.SetVerticalOffset (-1); Assert.AreEqual (p.VerticalOffset, 0, "6"); }
public void InScrollViewerCanContentScroll () { Window window = new Window (); ScrollViewer scroll_viewer = new ScrollViewer (); scroll_viewer.CanContentScroll = true; window.Content = scroll_viewer; StackPanel stack_panel = new StackPanel (); scroll_viewer.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button (); stack_panel.Children.Add (button); window.Show (); Assert.AreEqual (button.ActualWidth, scroll_viewer.ViewportWidth, "1"); Assert.AreEqual (button.ActualWidth, stack_panel.ActualWidth, "2"); }
public void ExtentSimple () { Window w = new Window (); ScrollViewer v = new ScrollViewer (); w.Content = v; StackPanel p = new StackPanel (); v.Content = p; global::System.Windows.Controls.Button b = new global::System.Windows.Controls.Button (); p.Children.Add (b); w.Show (); Assert.AreEqual (p.ExtentWidth, 0, "1"); Assert.AreEqual (p.ExtentHeight, 0, "2"); }
public void SizeInScrollViewerCanContentScroll () { Window window = new Window (); ScrollViewer scroll_viewer = new ScrollViewer (); scroll_viewer.CanContentScroll = true; window.Content = scroll_viewer; SizeInScrollViewerCanContentScrollStackPanel stack_panel = new SizeInScrollViewerCanContentScrollStackPanel (); scroll_viewer.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button (); stack_panel.Children.Add (button); window.Show (); Assert.AreEqual (stack_panel.ActualWidth, scroll_viewer.ViewportWidth, "1"); Assert.AreEqual (stack_panel.ActualHeight, scroll_viewer.ActualHeight, "2"); Assert.AreEqual (stack_panel.DesiredSize.Width, Utility.GetEmptyButtonSize (), "3"); Assert.AreEqual (stack_panel.DesiredSize.Height, Utility.GetEmptyButtonSize (), "4"); Assert.AreEqual (stack_panel.MeasureResult.Width, Utility.GetEmptyButtonSize (), "5"); Assert.AreEqual (stack_panel.MeasureResult.Height, Utility.GetEmptyButtonSize (), "6"); }
public void NotInScrollViewer () { Window window = new Window (); StackPanel stack_panel = new StackPanel (); window.Content = stack_panel; global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button (); stack_panel.Children.Add (button); window.Show (); Assert.AreEqual (button.ActualWidth, stack_panel.ActualWidth); }