MaterialDesignInXamlToolkit
MaterialDesignInXamlToolkit copied to clipboard
Added CornerRadius to DialogHost
Fix for #2772
Introduces a CornerRadius
DP on DialogHost
which is then used to round the corners of the PART_ContentCoverGrid
(ie. the grid which shows a dimmed overlay covering the area that should be disabled while the dialog is open).
In order to support a CornerRadius
, I introduced a Border
. Ideally I guess the PART_ContentCoverGrid
could have been changed to a Border
but that could potentially break back-compat in case someone is doing their own template and providing a Grid
named PART_ContentCoverGrid
. To (hopefully) avoid introducing a breaking change, I simple placed a Border
inside of the PART_ContentCoverGrid
, and then use the OpacityMask
on the PART_ContentCoverGrid
to enforce the masking out of content that is not within the bounds of the contained Border
.
My initial approach was to wrap PART_ContentCoverGrid
in a Border
, and the set ClipToBounds
on the Border
, but that does not work; the PART_ContentCoverGrid
is still allowed to render its background in the corner area which is "trimmed away" by the Border
, and thus it basically has no effect.
I added a simple UI test just to verify that the DP is correctly applied to the newly introduced Border
(named ContentCoverBorder
).
UPDATE
I did not actually update the demo application to showcase this, because I didn't really think it made a lot of sense in the uses that are showcased. But to test it out, you can just set the DP on any of the DialogHost
instances in there.
This looks great. Would you mind adding one more UI test that uses the embedded dialog host style? Just to ensure that both styles leverage the property.
This looks great. Would you mind adding one more UI test that uses the embedded dialog host style? Just to ensure that both styles leverage the property.
Sure, no problem 👍