Example #1
0
        public void Build()
        {
            Result = new MapPresenter();

            Result.Parent = null;

            TextFieldPresenter classNameFieldPresenter = new TextFieldPresenter();
            classNameFieldPresenter.FormatString = "Class Name: {0}";

            Result["ClassNamePresentation"] = classNameFieldPresenter;

            AddFieldBinding(classNameFieldPresenter, "ClassName");

            CollectionPresenter studentsPresenter = new CollectionPresenter();

            Result["StudentsPresenter"] = studentsPresenter;

            AddCollectionBinding(studentsPresenter, "People");
        }
Example #2
0
        void AddFieldBinding(TextFieldPresenter fieldPresenter, string propName)
        {
            OneWayPropertyBindingWithPath fieldBinding = new OneWayPropertyBindingWithPath();

            fieldBinding.SourceObj = TheClass;
            fieldBinding.SourcePathLinks = new List<BindingPathLink<object>>
            {
                new BindingPathLink<object>(propName)
            };
            fieldBinding.TargetObj = fieldPresenter;
            fieldBinding.TargetPathLinks = new List<BindingPathLink<object>> { new BindingPathLink<object>("TheValue") };

            fieldBinding.Bind();

            TheBindingsAProp.SetProperty(fieldPresenter, fieldBinding);
        }
Example #3
0
        MapPresenter GetPersonMap(Person person)
        {
            MapPresenter result = new MapPresenter();

            result["FirstName"] = new TextFieldPresenter
            {
                TheValue = person.FirstName,
                FormatString = "FirstName: {0}"
            };

            result["LastName"] = new TextFieldPresenter
            {
                TheValue = person.LastName,
                FormatString = "LastName: {0}"
            };

            return result;
        }