Inheritance: System.Windows.Controls.ListBox, IPoker
Ejemplo n.º 1
0
        public void TemplateChild()
        {
            ListBoxPoker box = new ListBoxPoker();

            CreateAsyncTest(box, () => {
                DependencyObject o = box.GetTemplateChild("ScrollViewer");
                Assert.IsNotNull(o);
            });
        }
Ejemplo n.º 2
0
        public void VisualTree2()
        {
            ListBoxPoker box = new ListBoxPoker();

            box.ItemsSource = new int [] { 1, 2, 3 };

            Assert.IsFalse(box.TemplateApplied, "#1");
            Assert.VisualChildren(box, "#2");              // No VisualChildren

            // The presenter is attached after we measure
            box.Arrange(new Rect(0, 0, 100, 100));
            Assert.VisualChildren(box, "#3");
            Assert.IsFalse(box.TemplateApplied, "#4");
        }
Ejemplo n.º 3
0
        public void VisualTree()
        {
            ListBoxPoker box = new ListBoxPoker();

            box.ItemsSource = new int [] { 1, 2, 3 };

            Assert.VisualChildren(box, "#2");              // No VisualChildren

            // The presenter is attached after we measure
            Assert.IsFalse(box.TemplateApplied, "#1");
            box.Measure(new Size(100, 100));
            Assert.IsTrue(box.TemplateApplied, "#2");

            // A standard ItemsPresenter attaches itself during Measure
            Assert.VisualChildren(box, "#3",
                                  new VisualNode <ItemsPresenter> ("#a",
                                                                   new VisualNode <VirtualizingStackPanel> ("#b",
                                                                                                            new VisualNode <ListBoxItem> ("#c1", (VisualNode [])null),
                                                                                                            new VisualNode <ListBoxItem> ("#c2", (VisualNode [])null),
                                                                                                            new VisualNode <ListBoxItem> ("#c3", (VisualNode [])null)
                                                                                                            )
                                                                   )
                                  );

            // The template from the attached Style has attached itself here.
            CreateAsyncTest(box, () => {
                Assert.VisualChildren(box, "#4",
                                      new VisualNode <Grid> ("#0",
                                                             new VisualNode <Border> ("#d",
                                                                                      new VisualNode <ScrollViewer> ("#e",
                                                                                                                     new VisualNode <Border> ("#f",
                                                                                                                                              new VisualNode <Grid> ("#g", (VisualNode [])null)
                                                                                                                                              )
                                                                                                                     )
                                                                                      ),
                                                             new VisualNode <Border>("#h", (VisualNode[])null)
                                                             )
                                      );
            });
        }
Ejemplo n.º 4
0
		public void VisualTree2 ()
		{
			ListBoxPoker box = new ListBoxPoker ();
			box.ItemsSource = new int [] { 1, 2, 3 };

			Assert.IsFalse (box.TemplateApplied, "#1");
			Assert.VisualChildren (box, "#2"); // No VisualChildren

			// The presenter is attached after we measure
			box.Arrange (new Rect (0, 0, 100, 100));
			Assert.VisualChildren (box, "#3");
			Assert.IsFalse (box.TemplateApplied, "#4");
		}
Ejemplo n.º 5
0
		public void VisualTree ()
		{
			ListBoxPoker box = new ListBoxPoker ();
			box.ItemsSource = new int [] { 1, 2, 3 };

			Assert.VisualChildren (box, "#2"); // No VisualChildren

			// The presenter is attached after we measure
			Assert.IsFalse (box.TemplateApplied, "#1");
			box.Measure (new Size (100, 100));
			Assert.IsTrue (box.TemplateApplied, "#2");

			// A standard ItemsPresenter attaches itself during Measure
			Assert.VisualChildren (box, "#3",
				new VisualNode<ItemsPresenter> ("#a",
					new VisualNode<VirtualizingStackPanel> ("#b",
						new VisualNode<ListBoxItem> ("#c1", (VisualNode []) null),
						new VisualNode<ListBoxItem> ("#c2", (VisualNode []) null),
						new VisualNode<ListBoxItem> ("#c3", (VisualNode []) null)
					)
				)
			);

			// The template from the attached Style has attached itself here.
			CreateAsyncTest (box, () => {
				Assert.VisualChildren (box, "#4",
					new VisualNode<Grid> ("#0",
						new VisualNode<Border> ("#d",
							new VisualNode<ScrollViewer> ("#e",
								new VisualNode<Border> ("#f",
									new VisualNode<Grid> ("#g", (VisualNode []) null)
								)
							)
						),
						new VisualNode <Border>("#h", (VisualNode[])null)
					)
				);
			});
		}
Ejemplo n.º 6
0
		public void TemplateChild ()
		{
			ListBoxPoker box = new ListBoxPoker ();

			CreateAsyncTest (box, () => {
				DependencyObject o = box.GetTemplateChild ("ScrollViewer");
				Assert.IsNotNull (o);
			});
		}