fix #1140 "System.ArgumentNullException: 'Value cannot be null. Parameter name: defaultDestinationValue'" #1398
+736
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: #1140
Information
I tried to create an example when a crash occurs with the exception
System.ArgumentNullException: 'Value cannot be null. Parameter name: defaultDestinationValue'
, and also to make a fix for this problem.The example is named
Wpf.Ui.Demo.SetResources.Simple
, it implements one problem that I encountered, this is when you create a grouping style for a grid with an expander. The problem is that when you open a page with an expander, everything seems to be fine, but after switching to another page, the application crashes.This problem apparently occurs due to the initialization order. When you use app.resources, this problem does not occur. In the example, I reproduced the situation when the theme resources are not applied at application startup, but are applied when a specific window or page is created.
The example needs to be improved, add another problematic control
CardExpander
apparently it also has this problem, but I was not able to reproduce it in my tests (there is a fix for this control in this PR).