I’ve got a MainView and a ChildView and a MainViewModel and a ChildViewModel.
On my MainView i got a SaveButton which is bound to the VM through a command.
When that button is clicked the textbox on the ChildView should lose the focus and update their VM.
How can i do that?
<DataGridTemplateColumn Header="FOR [percent]" Width="*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Knowles_ShiftreportEditor_Controls:NumberTextbox Text="{Binding ForValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" AllowsDecimal="True"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
i have the same problem with button IsDefault=true or Keybinding. what i have done is to register an eventhandler in my app.xaml.cs OnStartup()
now the focus is set to the button and the textbox binding work like expected.