Fix counter issue

This commit is contained in:
Bernat Borràs Civil 2025-04-11 16:43:20 +02:00
parent ac57c930cb
commit 11ad7f56d9
4 changed files with 123 additions and 28 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Threading.Tasks;
using Avalonia;
@ -70,6 +71,25 @@ namespace SourceGit.Views
InitializeComponent();
}
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
// When the DataContext changes, we need to re-evaluate any bindings
// This ensures that when the Commit property changes, the UI is updated
if (DataContext is ViewModels.CommitDetail detail)
{
detail.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(detail.Commit))
{
// Force UI update for the commit lines
InvalidateVisual();
}
};
}
}
private void OnCopyCommitSHA(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: Models.Commit commit })