Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveCarouselPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveCarouselPage<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveContentPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveContentPage<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveContentView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentView<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveContentView<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 5 additions & 3 deletions src/ReactiveUI.XamForms/XamForms/ReactiveEntryCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ namespace ReactiveUI.XamForms
public class ReactiveEntryCell<TViewModel> : EntryCell, IViewFor<TViewModel>
where TViewModel : class
{
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create<ReactiveEntryCell<TViewModel>, TViewModel>(
x => x.ViewModel,
null,
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveEntryCell<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

public TViewModel ViewModel
Expand Down
8 changes: 5 additions & 3 deletions src/ReactiveUI.XamForms/XamForms/ReactiveImageCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ namespace ReactiveUI.XamForms
public class ReactiveImageCell<TViewModel> : ImageCell, IViewFor<TViewModel>
where TViewModel : class
{
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create<ReactiveImageCell<TViewModel>, TViewModel>(
x => x.ViewModel,
null,
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveImageCell<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

public TViewModel ViewModel
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveMasterDetailPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveMasterDetailPage<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveMultiPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveMultiPage<TPage, TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveNavigationPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveNavigationPage<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 5 additions & 3 deletions src/ReactiveUI.XamForms/XamForms/ReactiveSwitchCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ namespace ReactiveUI.XamForms
public class ReactiveSwitchCell<TViewModel> : SwitchCell, IViewFor<TViewModel>
where TViewModel : class
{
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create<ReactiveSwitchCell<TViewModel>, TViewModel>(
x => x.ViewModel,
null,
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveSwitchCell<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

public TViewModel ViewModel
Expand Down
8 changes: 6 additions & 2 deletions src/ReactiveUI.XamForms/XamForms/ReactiveTabbedPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public TViewModel ViewModel {
get { return (TViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ReactiveContentPage<TViewModel>, TViewModel>(x => x.ViewModel, default(TViewModel), BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveTabbedPage<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

object IViewFor.ViewModel {
get { return ViewModel; }
Expand Down
8 changes: 5 additions & 3 deletions src/ReactiveUI.XamForms/XamForms/ReactiveTextCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ namespace ReactiveUI.XamForms
public class ReactiveTextCell<TViewModel> : TextCell, IViewFor<TViewModel>
where TViewModel : class
{
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create<ReactiveTextCell<TViewModel>, TViewModel>(
x => x.ViewModel,
null,
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveTextCell<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

public TViewModel ViewModel
Expand Down
8 changes: 5 additions & 3 deletions src/ReactiveUI.XamForms/XamForms/ReactiveViewCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ namespace ReactiveUI.XamForms
public class ReactiveViewCell<TViewModel> : ViewCell, IViewFor<TViewModel>
where TViewModel : class
{
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create<ReactiveViewCell<TViewModel>, TViewModel>(
x => x.ViewModel,
null,
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(TViewModel),
typeof(ReactiveViewCell<TViewModel>),
default(TViewModel),
BindingMode.OneWay);

public TViewModel ViewModel
Expand Down
12 changes: 8 additions & 4 deletions src/ReactiveUI.XamForms/XamForms/RoutedViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ namespace ReactiveUI.XamForms
{
public class RoutedViewHost : NavigationPage, IActivatable
{
public static readonly BindableProperty RouterProperty = BindableProperty.Create<RoutedViewHost, RoutingState>(
x => x.Router, null, BindingMode.OneWay);
public static readonly BindableProperty RouterProperty = BindableProperty.Create(
nameof(Router),
typeof(RoutingState),
typeof(RoutedViewHost),
default(RoutingState),
BindingMode.OneWay);

public RoutingState Router {
get { return (RoutingState)GetValue(RouterProperty); }
Expand Down Expand Up @@ -75,7 +79,7 @@ public RoutedViewHost()
})
.Do(_ => ((IViewFor)this.CurrentPage).ViewModel = Router.GetCurrentViewModel())
.Subscribe());

d(this.WhenAnyObservable(x => x.Router.Navigate)
.SelectMany(_ => PageForViewModel(Router.GetCurrentViewModel()))
.SelectMany(async x => {
Expand Down Expand Up @@ -135,7 +139,7 @@ public RoutedViewHost()
.Subscribe();
}

protected IObservable<Page> PageForViewModel(IRoutableViewModel vm)
protected IObservable<Page> PageForViewModel(IRoutableViewModel vm)
{
if (vm == null) return Observable.Empty<Page>();

Expand Down
24 changes: 18 additions & 6 deletions src/ReactiveUI.XamForms/XamForms/ViewModelViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ public object ViewModel {
get { return GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly BindableProperty ViewModelProperty =
BindableProperty.Create<ViewModelViewHost, object>(x => x.ViewModel, null, BindingMode.OneWay);
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create(
nameof(ViewModel),
typeof(object),
typeof(ViewModelViewHost),
default(object),
BindingMode.OneWay);

/// <summary>
/// If no ViewModel is displayed, this content (i.e. a control) will be displayed.
Expand All @@ -32,15 +36,23 @@ public View DefaultContent {
get { return (View)GetValue(DefaultContentProperty); }
set { SetValue(DefaultContentProperty, value); }
}
public static readonly BindableProperty DefaultContentProperty =
BindableProperty.Create<ViewModelViewHost, View>(x => x.DefaultContent, null, BindingMode.OneWay);
public static readonly BindableProperty DefaultContentProperty = BindableProperty.Create(
nameof(DefaultContent),
typeof(View),
typeof(ViewModelViewHost),
default(View),
BindingMode.OneWay);

public IObservable<string> ViewContractObservable {
get { return (IObservable<string>)GetValue(ViewContractObservableProperty); }
set { SetValue(ViewContractObservableProperty, value); }
}
public static readonly BindableProperty ViewContractObservableProperty =
BindableProperty.Create<ViewModelViewHost, IObservable<string>>(x => x.ViewContractObservable, Observable.Never<string>(), BindingMode.OneWay);
public static readonly BindableProperty ViewContractObservableProperty = BindableProperty.Create(
nameof(ViewContractObservable),
typeof(string),
typeof(ViewModelViewHost),
Observable.Never<string>(),
BindingMode.OneWay);

public IViewLocator ViewLocator { get; set; }

Expand Down