Inheritance: System.Windows.Controls.ListBox, IPoker
コード例 #1
0
        public void TemplateChild()
        {
            ListBoxPoker box = new ListBoxPoker();

            CreateAsyncTest(box, () => {
                DependencyObject o = box.GetTemplateChild("ScrollViewer");
                Assert.IsNotNull(o);
            });
        }
コード例 #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");
        }
コード例 #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)
                                                             )
                                      );
            });
        }
コード例 #4
0
ファイル: ListBoxTest.cs プロジェクト: shana/moon
		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");
		}
コード例 #5
0
ファイル: ListBoxTest.cs プロジェクト: shana/moon
		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)
					)
				);
			});
		}
コード例 #6
0
ファイル: ListBoxTest.cs プロジェクト: shana/moon
		public void TemplateChild ()
		{
			ListBoxPoker box = new ListBoxPoker ();

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