Skip to content

Commit f00b159

Browse files
feature: automatically select latest log in logs view
1 parent 53b1a2f commit f00b159

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Views/ViewLogs.axaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Avalonia.Controls;
22
using Avalonia.Input;
3+
using Avalonia.Interactivity;
34

45
namespace SourceGit.Views
56
{
@@ -11,6 +12,12 @@ public ViewLogs()
1112
InitializeComponent();
1213
}
1314

15+
private void OnLoaded(object sender, RoutedEventArgs e)
16+
{
17+
if (DataContext is ViewModels.ViewLogs vm && vm.Logs.Count > 0)
18+
vm.SelectedLog = vm.Logs[0];
19+
}
20+
1421
private void OnLogContextRequested(object sender, ContextRequestedEventArgs e)
1522
{
1623
if (sender is not Grid { DataContext: ViewModels.CommandLog log } grid || DataContext is not ViewModels.ViewLogs vm)

0 commit comments

Comments
 (0)