Skip to content

Commit

Permalink
Avalonia v11 - Focus. Removed unnecessary Avalonia-v11-Update.md; see…
Browse files Browse the repository at this point in the history
… PR description
  • Loading branch information
DamianSuess committed Aug 16, 2023
1 parent bc99baf commit b1431d5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 62 deletions.
46 changes: 0 additions & 46 deletions Avalonia-v11-Update.md

This file was deleted.

4 changes: 2 additions & 2 deletions ILSpy.Core/CreateListDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void InitializeComponent()
//ListName.TextInput += TextBox_TextChanged;
ListName.GetObservable(TextBox.TextProperty).Subscribe(text => TextBox_TextChanged(this, new TextInputEventArgs{Text = text}));

TemplateApplied += (sender, e) => Application.Current.FocusManager.Focus(ListName);
TemplateApplied += (sender, e) => ListName.Focus();
}

private void TextBox_TextChanged(object sender, TextInputEventArgs e)
Expand Down Expand Up @@ -69,4 +69,4 @@ public string NewListName
}

}
}
}
6 changes: 0 additions & 6 deletions ILSpy.Core/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,15 +683,9 @@ private bool CanResolveTypeInPEFile(PEFile module, ITypeReference typeRef, out E

void MainWindow_Loaded(object sender, EventArgs e)
{
// Avalonia v11
//// this.FocusManager.GetFocusedElement().Focus();

var focusManager = TopLevel.GetTopLevel(this).FocusManager;
focusManager.GetFocusedElement().Focus();

// Avalonia v0.10
//// Application.Current.FocusManager.Focus(this);

InitToolbar();

ILSpySettings spySettings = this.spySettingsForMainWindow_Loaded;
Expand Down
9 changes: 1 addition & 8 deletions ILSpy.Core/OpenListDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,7 @@ private void InitializeComponent()
createButton.Click += CreateButton_Click;
resetButton.Click += ResetButton_Click;

// Avalonia v0.10
//// TemplateApplied += (sender, e) => Application.Current.FocusManager.Focus(listView);

TemplateApplied += (sender, e) => {
// Avalonia v11
var focusManager = TopLevel.GetTopLevel(listView).FocusManager;
focusManager.GetFocusedElement().Focus();
};
TemplateApplied += (sender, e) => listView.Focus();

listView.TemplateApplied += listView_Loaded;
}
Expand Down

0 comments on commit b1431d5

Please sign in to comment.