Skip to content

Commit

Permalink
Fixed runtime binding exception in wasdk gallery where the generated …
Browse files Browse the repository at this point in the history
…options pane is used.
  • Loading branch information
Arlodotexe committed Sep 17, 2024
1 parent 0a9aa0e commit c18adc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public GeneratedSampleOptionsRenderer()
/// The backing <see cref="DependencyProperty"/> for <see cref="SampleOptions"/>.
/// </summary>
public static readonly DependencyProperty SampleOptionsProperty =
DependencyProperty.Register(nameof(SampleOptions), typeof(IEnumerable<IGeneratedToolkitSampleOptionViewModel>), typeof(GeneratedSampleOptionsRenderer), new PropertyMetadata(null));
DependencyProperty.Register(nameof(SampleOptions), typeof(List<IGeneratedToolkitSampleOptionViewModel>), typeof(GeneratedSampleOptionsRenderer), new PropertyMetadata(new List<IGeneratedToolkitSampleOptionViewModel>()));

/// <summary>
/// The generated sample options that should be displayed to the user.
/// </summary>
public IEnumerable<IGeneratedToolkitSampleOptionViewModel>? SampleOptions
public List<IGeneratedToolkitSampleOptionViewModel> SampleOptions
{
get => (IEnumerable<IGeneratedToolkitSampleOptionViewModel>?)GetValue(SampleOptionsProperty);
get => (List<IGeneratedToolkitSampleOptionViewModel>)GetValue(SampleOptionsProperty);
set => SetValue(SampleOptionsProperty, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,13 @@ private async Task LoadData()
// Generated properties reference these in getters and setters.
propertyContainer.GeneratedPropertyMetadata = Metadata.GeneratedSampleOptions;

SampleOptionsPaneInstance = new GeneratedSampleOptionsRenderer
if (propertyContainer.GeneratedPropertyMetadata is not null)
{
SampleOptions = propertyContainer.GeneratedPropertyMetadata
};
SampleOptionsPaneInstance = new GeneratedSampleOptionsRenderer
{
SampleOptions = propertyContainer.GeneratedPropertyMetadata.ToList()
};
}
}
else
{
Expand Down

0 comments on commit c18adc1

Please sign in to comment.