Пример #1
0
        public void ITypeDescriptorContextTest()
        {
            PropertyGrid pg = new PropertyGrid();

            var rootObj = new NestedObj0();

            rootObj.Property1                     = new NestedObj1();
            rootObj.Property1.Property2           = new NestedObj2();
            rootObj.Property1.Property2.Property3 = new NestedObj3();
            pg.SelectedObject                     = rootObj;

            GridItem   gridItem_Property1 = pg.GetRootItem();
            INestedObj ownerOf_Property1  = rootObj;

            CheckGridItem(ownerOf_Property1, "Property1", gridItem_Property1);

            GridItem   gridItem_Property2 = gridItem_Property1.GridItems["Property2"];
            INestedObj ownerOf_Property2  = rootObj.Property1;

            CheckGridItem(ownerOf_Property2, "Property2", gridItem_Property2);

            GridItem   gridItem_Property3 = gridItem_Property2.GridItems["Property3"];
            INestedObj ownerOf_Property3  = rootObj.Property1.Property2;

            CheckGridItem(ownerOf_Property3, "Property3", gridItem_Property3);
        }
Пример #2
0
        public void CustomExpandableConverterTest()
        {
            PropertyGrid pg = new PropertyGrid();

            var rootObj = new ConverterTestRootObject();

            pg.SelectedObject = rootObj;

            GridItem customExpandableGridItem = pg.GetRootItem();

            Assert.AreEqual("CustomExpandableProperty", customExpandableGridItem.Label);

            var substitutedGridItems = customExpandableGridItem.GridItems;

            Assert.AreEqual(1, substitutedGridItems.Count);
            Assert.NotNull(substitutedGridItems["SomeProperty"]);
        }