Use BooleanBoxes for default values in DependencyProperty metadata #10711
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.
Description
While we have
SetValue
special-cased forBooleanBoxes
and a lot of bool-DPs have properly set their default values withBooleanBoxes.TrueBox
orBooleanBoxes.FalseBox
, there are quite a few outliers as I've noticed today when digging through the boxed booleans on the heap.Therefore, this PR does 3 things:
MS.Internal.KnownBoxes
as a global using, since it is used in most of our classes3.1) Since we have 1-3 classes there, that doesn't bring any code bloat
3.2) That means I've removed the usings in all other files
I didn't do anything in
Ribbon
because itWindowsBase
doesn't have internals visible to the assembly.Customer Impact
Decreases number of booleans by a big amount, decreased memory usage, improved perf slightly.
Regression
No.
Testing
Local build.
Risk
I did most of the work replacement work with either MilCodeGen or regex, but there were a few manual changes, so it should be fine. Note that using the boxes is not a new thing, this just makes sure all boolean DPs use it.
Microsoft Reviewers: Open in CodeFlow