using Avalonia.Controls; using Avalonia.Interactivity; using LehrerApp.Desktop.ViewModels.Students; namespace LehrerApp.Desktop.Views.Students; public partial class StudentPickerDialog : Window { public StudentPickerDialog() => InitializeComponent(); protected override void OnOpened(EventArgs e) { base.OnOpened(e); this.FindControl("SearchBox")?.Focus(); } private void OnSave(object? sender, RoutedEventArgs e) { if (DataContext is not StudentPickerDialogViewModel vm) return; vm.SelectCommand.Execute(null); if (vm.Result is not null) Close(vm.Result); } private void OnCancel(object? sender, RoutedEventArgs e) => Close(null); }