Skip to content

Commit 25f4bdc

Browse files
committed
Merge branch 'main' into winui
# Conflicts: # CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs # CommunityToolkit.WinUI.SampleApp/Common/Vector3Converter.cs # CommunityToolkit.WinUI.SampleApp/Data/DataGridDataSource.cs # CommunityToolkit.WinUI.SampleApp/Models/PropertyDescriptor/ThicknessPropertyOptions.cs # CommunityToolkit.WinUI.SampleApp/Models/Sample.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/Animations/Effects/FadeBehaviorXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/Animations/Shadows/AnimatedCardShadowXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/DataGrid/DataGridCode.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/DropShadowPanel.png # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/DropShadowPanelPage.xaml # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/DropShadowPanelPage.xaml.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/DropShadowPanelXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/Trex.png # CommunityToolkit.WinUI.SampleApp/SamplePages/DropShadowPanel/Unicorn.png # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/RichSuggestBox.png # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/RichSuggestBoxCode.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/RichSuggestBoxPage.xaml # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/RichSuggestBoxPage.xaml.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/RichSuggestBoxXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/RichSuggestBox/SuggestionTemplateSelector.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/AttachedDropShadowPage.xaml # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/AttachedDropShadowPage.xaml.cs # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/AttachedShadowCompositionXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/AttachedShadowWin2DXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/DropShadowPanel.png # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/DropShadowPanelXaml.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/Trex.png # CommunityToolkit.WinUI.SampleApp/SamplePages/Shadows/Unicorn.png # CommunityToolkit.WinUI.SampleApp/SamplePages/Triggers/ControlSizeTrigger.bind # CommunityToolkit.WinUI.SampleApp/SamplePages/samples.json # CommunityToolkit.WinUI.UI.Animations/Xaml/Abstract/ShadowAnimation{TValue,TKeyFrame}.cs # CommunityToolkit.WinUI.UI.Animations/Xaml/Interfaces/IAttachedTimeline.cs # CommunityToolkit.WinUI.UI.Animations/Xaml/Shadows/BlurRadiusDropShadowAnimation.cs # CommunityToolkit.WinUI.UI.Animations/Xaml/Shadows/ColorDropShadowAnimation.cs # CommunityToolkit.WinUI.UI.Animations/Xaml/Shadows/OffsetDropShadowAnimation.cs # CommunityToolkit.WinUI.UI.Animations/Xaml/Shadows/OpacityDropShadowAnimation.cs # CommunityToolkit.WinUI.UI.Controls.Input.Design/Controls/RichSuggestBox.Metadata.cs # CommunityToolkit.WinUI.UI.Controls.Input.Design/Controls/RichSuggestBox.Typedata.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Document.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Events.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Helpers.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Properties.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Suggestion.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestBox.xaml # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestQuery.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestToken.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestTokenPointerOverEventArgs.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/RichSuggestTokenSelectedEventArgs.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/SuggestionChosenEventArgs.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/SuggestionPopupPlacementMode.cs # CommunityToolkit.WinUI.UI.Controls.Input/RichSuggestBox/SuggestionRequestedEventArgs.cs # CommunityToolkit.WinUI.UI.Controls.Layout.Design/Controls/ListDetailsView.Metadata.cs # CommunityToolkit.WinUI.UI.Controls.Layout.Design/Controls/ListDetailsView.Typedata.cs # CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.BackButton.cs # CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.Events.cs # CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs # CommunityToolkit.WinUI.UI.Controls.Layout/ListDetailsView/ListDetailsView.xaml # CommunityToolkit.WinUI.UI.Media/Shadows/AttachedCardShadow.cs # CommunityToolkit.WinUI.UI/Helpers/IAlphaMaskProvider.cs # CommunityToolkit.WinUI.UI/Properties/AssemblyInfo.cs # CommunityToolkit.WinUI.UI/Shadows/AttachedDropShadow.cs # CommunityToolkit.WinUI.UI/Shadows/AttachedShadowBase.cs # CommunityToolkit.WinUI.UI/Shadows/AttachedShadowElementContext.cs # CommunityToolkit.WinUI.UI/Shadows/Effects.cs # CommunityToolkit.WinUI.UI/Shadows/IAlphaMaskProvider.cs # CommunityToolkit.WinUI.UI/Shadows/IAttachedShadow.cs # CommunityToolkit.WinUI.UI/Shadows/TypedResourceKey.cs # CommunityToolkit.WinUI.UI/Triggers/ControlSizeTrigger.cs # Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj # Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/ThicknessPropertyOptions.cs # Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DropShadowPanel/DropShadowPanel.png # Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DropShadowPanel/DropShadowPanelXaml.bind # Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DropShadowPanel/Trex.png # Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DropShadowPanel/Unicorn.png # Microsoft.Toolkit.Uwp.UI.Animations/Properties/AssemblyInfo.cs # Microsoft.Toolkit.Uwp.UI.Controls.Input/Themes/Generic.xaml # Microsoft.Toolkit.Uwp.UI/Helpers/IAlphaMaskProvider.cs # UITests/UITests.App/App.xaml # UITests/UITests.App/UITests.App.csproj
2 parents 96521a6 + 3f29bde commit 25f4bdc

File tree

111 files changed

+6640
-836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+6640
-836
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ What kind of change does this PR introduce?
3838
Please check if your PR fulfills the following requirements: <!-- and remove the ones that are not applicable to the current PR -->
3939

4040
- [ ] Tested code with current [supported SDKs](../#supported)
41-
- [ ] Pull Request has been submitted to the documentation repository [instructions](../blob/main/Contributing.md#docs). Link: <!-- docs PR link -->
41+
- [ ] New component
42+
- [ ] Pull Request has been submitted to the documentation repository [instructions](../blob/main/Contributing.md#docs). Link: <!-- docs PR link -->
43+
- [ ] Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
44+
- [ ] If control, added to Visual Studio Design project
4245
- [ ] Sample in sample app has been added / updated (for bug fixes / features)
4346
- [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/CommunityToolkit/WindowsCommunityToolkit-design-assets)
4447
- [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/CommunityToolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
@@ -51,4 +54,4 @@ Please note that breaking changes are likely to be rejected within minor release
5154

5255
## Other information
5356

54-
<!-- Please add any other information that might be helpful to reviewers. -->
57+
<!-- Please add any other information that might be helpful to reviewers. -->

CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
240240
}
241241
}
242242

243+
// In case the backing field is exactly named "value", we need to add the "this." prefix to ensure that comparisons and assignments
244+
// with it in the generated setter body are executed correctly and without conflicts with the implicit value parameter.
245+
ExpressionSyntax fieldExpression = fieldSymbol.Name switch
246+
{
247+
"value" => MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), IdentifierName("value")),
248+
string name => IdentifierName(name)
249+
};
250+
243251
BlockSyntax setterBlock;
244252

245253
if (validationAttributes.Count > 0)
@@ -263,10 +271,10 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
263271

264272
// Generate the inner setter block as follows:
265273
//
266-
// if (!global::System.Collections.Generic.EqualityComparer<<FIELD_TYPE>>.Default.Equals(<FIELD_NAME>, value))
274+
// if (!global::System.Collections.Generic.EqualityComparer<<FIELD_TYPE>>.Default.Equals(this.<FIELD_NAME>, value))
267275
// {
268276
// OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.PropertyNamePropertyChangingEventArgs); // Optional
269-
// <FIELD_NAME> = value;
277+
// this.<FIELD_NAME> = value;
270278
// OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.PropertyNamePropertyChangedEventArgs);
271279
// ValidateProperty(value, <PROPERTY_NAME>);
272280
// OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.Property1PropertyChangedEventArgs); // Optional
@@ -291,7 +299,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
291299
IdentifierName("Default")),
292300
IdentifierName("Equals")))
293301
.AddArgumentListArguments(
294-
Argument(IdentifierName(fieldSymbol.Name)),
302+
Argument(fieldExpression),
295303
Argument(IdentifierName("value")))),
296304
Block(
297305
ExpressionStatement(
@@ -303,7 +311,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
303311
ExpressionStatement(
304312
AssignmentExpression(
305313
SyntaxKind.SimpleAssignmentExpression,
306-
IdentifierName(fieldSymbol.Name),
314+
fieldExpression,
307315
IdentifierName("value"))),
308316
ExpressionStatement(
309317
InvocationExpression(IdentifierName("OnPropertyChanged"))
@@ -346,7 +354,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
346354
ExpressionStatement(
347355
AssignmentExpression(
348356
SyntaxKind.SimpleAssignmentExpression,
349-
IdentifierName(fieldSymbol.Name),
357+
fieldExpression,
350358
IdentifierName("value"))),
351359
ExpressionStatement(
352360
InvocationExpression(IdentifierName("OnPropertyChanged"))
@@ -384,7 +392,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
384392
IdentifierName("Default")),
385393
IdentifierName("Equals")))
386394
.AddArgumentListArguments(
387-
Argument(IdentifierName(fieldSymbol.Name)),
395+
Argument(fieldExpression),
388396
Argument(IdentifierName("value")))),
389397
updateAndNotificationBlock));
390398
}

0 commit comments

Comments
 (0)