refactor: remove binding null warnings

This commit is contained in:
leo 2024-08-06 15:33:23 +08:00
parent 1d15c4c95f
commit a7ea61f9af
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View file

@ -84,7 +84,7 @@
<v:CommitSubjectPresenter Classes="primary"
Subject="{Binding Subject}"
IssueTrackerRules="{Binding $parent[v:Histories].((vm:Histories)DataContext).IssueTrackerRules}"
IssueTrackerRules="{Binding $parent[v:Histories].IssueTrackerRules}"
Opacity="{Binding Opacity}"
FontWeight="{Binding FontWeight}"/>
</StackPanel>

View file

@ -459,6 +459,16 @@ namespace SourceGit.Views
set => SetValue(NavigationIdProperty, value);
}
public AvaloniaList<Models.IssueTrackerRule> IssueTrackerRules
{
get
{
if (DataContext is ViewModels.Histories histories)
return histories.IssueTrackerRules;
return null;
}
}
static Histories()
{
NavigationIdProperty.Changed.AddClassHandler<Histories>((h, _) =>