Manage focus
Manage focus
The View
<TextBox Margin="10" Text="{markup:EditorBinding Path=SampleText}">
<i:Interaction.Behaviors>
<lb:Focus ControlledBy="{Binding Path=FocusedElementKey}" UsingKey="SampleText" />
</i:Interaction.Behaviors>
</TextBox>The ViewModel
class MainViewModel : AbstractViewModel
{
public void SetFocus()
{
this.MoveFocusTo(() => this.SampleText);
}
public String SampleText
{
get { return this.GetPropertyValue(() => this.SampleText); }
set { this.SetPropertyValue(() => this.SampleText, value); }
}
}Last updated