Fix more buttons being enabled/disabled issues

This commit is contained in:
2026-02-17 13:22:11 +09:00
parent f9294be2dd
commit ff38722e6c
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -92,7 +92,15 @@ class MainViewModel : BaseViewModel, IFontResolver
public ObservableCollection<ReportFile> ReportFiles public ObservableCollection<ReportFile> ReportFiles
{ {
get => _reportFiles; get => _reportFiles;
set { _reportFiles = value; NotifyPropertyChanged(); } set
{
_reportFiles = value;
NotifyPropertyChanged();
_reportFiles.CollectionChanged += ( sender, e ) =>
{
NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled));
};
}
} }
private void LogInfo(string message, params object[]? arguments) private void LogInfo(string message, params object[]? arguments)
@@ -160,6 +168,7 @@ class MainViewModel : BaseViewModel, IFontResolver
ResortPDFItemsByDate(); ResortPDFItemsByDate();
} }
} }
NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled));
} }
public void ShowAbout() public void ShowAbout()
+1 -1
View File
@@ -151,7 +151,7 @@
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Spacing="4"> Spacing="4">
<Button Command="{Binding AddItem}" <Button Command="{Binding AddItem}"
IsEnabled="{Binding IsCreatePDFButtonEnabled}"> IsEnabled="{Binding !IsCreatingPDF}">
<TextBlock><Run Text="&#x002b;" FontFamily="{StaticResource FontAwesomeSolid}"/> Add Item</TextBlock> <TextBlock><Run Text="&#x002b;" FontFamily="{StaticResource FontAwesomeSolid}"/> Add Item</TextBlock>
</Button> </Button>
<Button Command="{Binding SaveInterimReportInfo}" <Button Command="{Binding SaveInterimReportInfo}"