http://updatecontrols.net/

Project Description

WPF data binding without INotifyPropertyChanged. It even binds through your View Model with no additional code.

And it works with Winforms. Bind through code using events.

Example

Wrap your object before giving it to the WPF DataContext:
public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
        DataContext = ForView.Wrap(new PersonPresentation(new Person()));
    }
}

The wrapped object given to DataContext is a plain-old-CLR-object.
public class PersonPresentation
{
    private Person _person;

    public PersonPresentation(Person person)
    {
        _person = person;
    }

    public Person Person
    {
        get { return _person; }
    }

    public string FirstLast
    {
        get { return _person.FirstName + " " + _person.LastName; }
    }

    public string LastFirst
    {
        get { return _person.LastName + ", " + _person.FirstName; }
    }

    public string Title
    {
        get { return "Person - " + (_person.DisplayStrategy == 0 ? FirstLast : LastFirst); }
    }
}

The underlying data object uses Independent properties to keep track of gets and sets. The wrapper can see these properties through layers of code, and automatically wires up property change notifications.
public class Person
{
    private string _firstName;
    private string _lastName;
    private int _displayStrategy;

    #region Independent properties
    // Generated by Update Controls --------------------------------
    private Independent _indDisplayStrategy = new Independent();
    private Independent _indFirstName = new Independent();
    private Independent _indLastName = new Independent();

    public string FirstName
    {
        get { _indFirstName.OnGet(); return _firstName; }
        set { _indFirstName.OnSet(); _firstName = value; }
    }

    public string LastName
    {
        get { _indLastName.OnGet(); return _lastName; }
        set { _indLastName.OnSet(); _lastName = value; }
    }

    public int DisplayStrategy
    {
        get { _indDisplayStrategy.OnGet(); return _displayStrategy; }
        set { _indDisplayStrategy.OnSet(); _displayStrategy = value; }
    }
    // End generated code --------------------------------
    #endregion
}
Last edited May 28 at 1:30 PM by MichaelLPerry1971, version 7

 

Want to leave feedback?
Please use Discussions or Reviews instead.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Version 2009.6.1.15196