ContentView<TViewModel>

A page bound to a typed ViewModel: bind with Bind(...).
public abstract class ContentView<TViewModel> : ContentView where TViewModel : class
Type parameterSummary
(class) TViewModelThe ViewModel type driving the page.

Constructors

Stores the ViewModel, so the derived constructor composes its tree against it directly.

protected ContentView(
  TViewModel viewModel)
ParameterSummary
TViewModel viewModelThe ViewModel driving this page.

Properties

ViewModel

The ViewModel this page was built around. Bindings resolve against it.

Type: TViewModel

public TViewModel ViewModel { get; }

Methods

Bind

Starts a binding that can only write control values to the ViewModel.

protected static ToSourceBindingBuilder<TViewModel> Bind()

Returns

Bind

Binds one way to a ViewModel property.

protected static BindingExpression<TViewModel, TViewModel, T> Bind<T>(
  Func<TViewModel, T> read,
  string? path = null)
ParameterSummary
Func<TViewModel, T> readThe ViewModel property to read.
(optional) string? pathThe source lambda, captured automatically to derive the property path.
Type parameterSummary
TThe bound value type.

Returns