Ejemplo n.º 1
0
        public static void Main()
        {
            Address sourceAddr = new Address();

            sourceAddr.City = "Miami";
            sourceAddr.Street = "Sterling Rd";

            MapBindingTreeNodeContainer addressNodeContainer =
                new MapBindingTreeNodeContainer();

            addressNodeContainer.TheObj = sourceAddr;

            addressNodeContainer
                .AddNewMapChild
                (
                    new PlainPropBindingPathLink<object>(nameof(Address.City))
                );

            addressNodeContainer
                .AddNewMapChild
                (
                    new PlainPropBindingPathLink<object>(nameof(Address.Street))
                );

            Contact sourceContact =
                new Contact()
                {
                    FirstName = "Nick",
                    HomeAddress = sourceAddr
                };

            MapBindingTreeNodeContainer contactNodeContainer =
                new MapBindingTreeNodeContainer();

            contactNodeContainer.AddChild
            (
                new PlainPropBindingPathLink<object>(nameof(Contact.HomeAddress)),
                addressNodeContainer
            );

            contactNodeContainer.AddNewMapChild
            (
                new PlainPropBindingPathLink<object>(nameof(Contact.FirstName))
            );

            contactNodeContainer.TheObj = sourceContact;

            // change home address
            sourceAddr = new Address();

            sourceAddr.City = "Boston";
            sourceAddr.Street = "Blenford Rd";

            sourceContact.HomeAddress = sourceAddr;
        }
Ejemplo n.º 2
0
        public MapBindingTreeNodeContainer AddNewMapChild(IBindingPathLink<object> pathLink)
        {
            CreateChildren();

            MapBindingTreeNodeContainer childContainer =
                new MapBindingTreeNodeContainer();

            AddChild(pathLink, childContainer);

            return childContainer;
        }