Вот простой пример того, что я хотел бы сделать:
Код: Выделить всё
public class Person
{
public string Name {get; set;}
public int Age {get; set;}
}
Код: Выделить всё
Код: Выделить всё
public partial class PersonNameView : ReactiveUserControl
{
public PersonNameView()
{
this.WhenActivated(disposables => {
this.Bind(ViewModel, vm => vm.Name, v => v.NameTextBox.Text).DisposeWith(disposables);
});
InitializeComponent();
}
}
Код: Выделить всё
Код: Выделить всё
public partial class PersonAgeView : ReactiveUserControl
{
public PersonAgeView()
{
this.WhenActivated(disposables => {
this.Bind(ViewModel, vm => vm.Age, v => v.AgeTextBox.Text).DisposeWith(disposables);
});
InitializeComponent();
}
}
Код: Выделить всё
Код: Выделить всё
public partial class MainView : ReactiveUserControl
{
public MainView()
{
//other code
this.WhenActivated(disposables => {
this.OneWayBind(ViewModel, vm => vm.Persons, v => v.PersonItemsControl.ItemsSource).DisposeWith(disposables);
});
InitializeComponent();
}
}
Код: Выделить всё
builder.RegisterType
().As().InstancePerDependency();
builder.RegisterType().As().InstancePerDependency();
Код: Выделить всё
PersonAgeViewИмейте в виду, что это очень упрощенный пример.
Подробнее здесь: https://stackoverflow.com/questions/766 ... reactiveui
Мобильная версия