Skip to content

Commit c6c6602

Browse files
author
msftbot[bot]
authored
Fixed ImageEx.CornerRadius property (#3529)
## Fixes #3528 <!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. --> <!-- Add a brief overview here of the feature/bug & fix. --> ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> - Bugfix <!-- - Feature --> <!-- - Code style update (formatting) --> <!-- - Refactoring (no functional changes, no api changes) --> <!-- - Build or CI related changes --> <!-- - Documentation content changes --> <!-- - Sample app changes --> <!-- - Other... Please describe: --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> The `ImageEx.CornerRadius` property isn't working anymore. ## What is the new behavior? <!-- Describe how was this issue resolved or changed? --> Modifying `ImageEx.CornerRadius` works correctly. ## Additional detail With #3440, we bumped the minimum SDK to 1809 (build 17763), which is the first one with the `CornerRadius` being available in the `Control` class. I suspect building the controls package with that minimum SDK caused an issue with `ImageEx` defining the `CornerRadius` property again (using `new`), so that the XAML `TemplateBinding` ended up failing to find the correct property to bind to. It might also be because setting the property in XAML ended up setting the value for the incorrect duplicate one, so that binding was never update. Regardless, with that minimum version available there's no reason to duplicate that property in the first place, we can just use the built-in one and bind to that. This PR removes that duplicate property, fixing the issue. > **NOTE:** this is _technically_ a breaking change as we're removing a public property, but users should effectively not really notice any difference, unless they were for some reason setting that very specific property through reflection, which is highly unlikely. Adding the tag for correctness, since this is still in fact a breaking change. Not likely to be noticed though 😄 ## PR Checklist Please check if your PR fulfills the following requirements: - [X] Tested code with current [supported SDKs](../readme.md#supported) - [ ] ~~Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->~~ - [ ] ~~Sample in sample app has been added / updated (for bug fixes / features)~~ - [ ] ~~Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)~~ - [X] Tests for the changes have been added (for bug fixes / features) (if applicable) - [X] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [ ] Contains **NO** breaking changes
2 parents 49760c3 + a279ebf commit c6c6602

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageEx.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
<Setter Property="Template">
1010
<Setter.Value>
1111
<ControlTemplate TargetType="controls:ImageEx">
12-
<Grid Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
12+
<Grid Background="{TemplateBinding Background}"
13+
CornerRadius="{TemplateBinding CornerRadius}"
14+
BorderBrush="{TemplateBinding BorderBrush}"
15+
BorderThickness="{TemplateBinding BorderThickness}">
1316
<Image Name="PlaceholderImage"
1417
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
1518
VerticalAlignment="{TemplateBinding VerticalAlignment}"

Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageExBase.Members.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ public partial class ImageExBase
2020
/// </summary>
2121
public static readonly DependencyProperty StretchProperty = DependencyProperty.Register(nameof(Stretch), typeof(Stretch), typeof(ImageExBase), new PropertyMetadata(Stretch.Uniform));
2222

23-
/// <summary>
24-
/// Identifies the <see cref="CornerRadius"/> dependency property.
25-
/// </summary>
26-
public static new readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(ImageExBase), new PropertyMetadata(new CornerRadius(0)));
27-
2823
/// <summary>
2924
/// Identifies the <see cref="DecodePixelHeight"/> dependency property.
3025
/// </summary>
@@ -81,16 +76,6 @@ public partial class ImageExBase
8176
/// </summary>
8277
public bool IsInitialized { get; private set; }
8378

84-
/// <summary>
85-
/// Gets or sets the CornerRadius for underlying image. <para/>
86-
/// Used to created rounded/circular images.
87-
/// </summary>
88-
public new CornerRadius CornerRadius
89-
{
90-
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
91-
set { SetValue(CornerRadiusProperty, value); }
92-
}
93-
9479
/// <summary>
9580
/// Gets or sets DecodePixelHeight for underlying bitmap
9681
/// </summary>

0 commit comments

Comments
 (0)