Skip to content

Commit

Permalink
Update src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
tomlm and coderabbitai[bot] authored Nov 25, 2024
1 parent 7c44cce commit 9bdc400
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ public FileOpenPicker(FilePickerOpenOptions options)
InitializeComponent();
}

public FileOpenPickerViewModel ViewModel => (FileOpenPickerViewModel)DataContext;
/// <summary>
/// Gets the view model associated with this picker.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the DataContext is null or not of type FileOpenPickerViewModel.</exception>
public FileOpenPickerViewModel ViewModel =>
DataContext as FileOpenPickerViewModel
?? throw new InvalidOperationException("DataContext is not properly initialized.");

Check failure on line 26 in src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'InvalidOperationException' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 26 in src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'InvalidOperationException' could not be found (are you missing a using directive or an assembly reference?)

private void InitializeComponent()
{
Expand Down

0 comments on commit 9bdc400

Please sign in to comment.