Sometimes you need to call a method of a UI element from your view model.
E.g. you may want to call the EditBox.Focus or the Frame.Navigate method.
The model:
public class SimpleViewModel : ViewModel
{
public SimpleViewModel()
{
TextBoxWrapper = new ControlWrapper();
}
public ControlWrapper TextBoxWrapper { get; private set; }
public void GotoField()
{
TextBoxWrapper.Focus();
}
}
XAML:
<TextBox Mvvm:ElementBinder.Wrapper="{Binding TextBoxWrapper}"/>