Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
5420874
Adding control width trigger
dpaulino Mar 19, 2021
8482a04
Paramitize pageSize and page count for unit tests
Rosuavio May 12, 2021
f6c65a5
Fix TokenizingTextBox header to behave like normal headers
marcelwgn Jul 8, 2021
6845464
Fix formatting
marcelwgn Jul 8, 2021
7f04027
Fix formatting the second
marcelwgn Jul 8, 2021
90e8a34
Ensure only visible tabs are selected
robloo Jul 27, 2021
f448ee3
Add additional color picker samples showing only a palette
robloo Jul 27, 2021
bc05c86
Make tabs automatically size uniformly to width
robloo Jul 27, 2021
e23a895
Set slider DefaultForeground value in style
robloo Jul 27, 2021
dde93f3
Add central OnDependencyPropertyChanged method in ColorPicker
robloo Jul 27, 2021
5540ece
Add footer templatepart
marcelwgn Jul 27, 2021
5564df3
Added TryRenameItemAsync and TryDeleteItemAsync to IFileStorageHelper
shweaver-MSFT Aug 9, 2021
a72b060
wip
shweaver-MSFT Aug 9, 2021
9e9a223
Updated AppDataStorageHelper to better support items in sub-folders.
shweaver-MSFT Aug 10, 2021
5ba4557
Merge branch 'master' of https://github.com/dpaulino/WindowsCommunity…
dpaulino Aug 12, 2021
41b580a
Adding support for height
dpaulino Aug 12, 2021
c0f7ff3
Renamed trigger
dpaulino Aug 12, 2021
b31758d
Added sample page
dpaulino Aug 12, 2021
a582f34
Bug fix
dpaulino Aug 12, 2021
cdf48d0
Fixed sample bug
dpaulino Aug 12, 2021
e62eb8b
Improving comments
dpaulino Aug 12, 2021
fd8aee5
Fixing xbind in sample
dpaulino Aug 12, 2021
5a523c9
Added unit test
dpaulino Aug 15, 2021
a5fc9eb
Windows 10X TwoPaneView for ListDetailsView
COM8 Aug 15, 2021
e3f5a7f
Fixed ambiguous doc hint
COM8 Aug 15, 2021
738b950
Merge branch 'master' of https://github.com/dpaulino/WindowsCommunity…
dpaulino Aug 15, 2021
435ec70
add RichSuggestBox to repo
huynhsontung Jan 3, 2021
4ee5606
update headers
huynhsontung Jan 15, 2021
583d5ae
add comments
huynhsontung Jan 20, 2021
60169ae
fix indentation issues
huynhsontung Jan 20, 2021
74c3219
more fixes
huynhsontung Jan 20, 2021
08122c3
xaml formatting
huynhsontung Jan 21, 2021
ce3726f
no conditional xaml due to bug
huynhsontung Jan 21, 2021
91093cf
add sample page
huynhsontung Jan 21, 2021
99872b1
add more template bindings
huynhsontung Jan 21, 2021
5f7a847
update headers (again)
huynhsontung Jan 21, 2021
3ba061e
no need for PlainTextCommandBarFlyout anymore
huynhsontung Jan 21, 2021
0fda83b
prune duplicate properties and fix flyout placement
huynhsontung Jan 22, 2021
197e36e
open suggestion up or down depends on available screen
huynhsontung Jan 26, 2021
4a0f38b
add SuggestionPopupPlacement property
huynhsontung Jan 27, 2021
71fcd9d
suggestion list scroll item into view on selection
huynhsontung Jan 27, 2021
ec4602e
move static helper methods into a separate file
huynhsontung Jan 27, 2021
5a7bc1c
fix formatting bug on token delete
huynhsontung Jan 27, 2021
a4b9114
fix floating placement calculation errors
huynhsontung Jan 27, 2021
ccaf97a
keep interior corners square in attached placement mode
huynhsontung Jan 30, 2021
a49a27e
fix lint issue
huynhsontung Jan 30, 2021
b67ae42
option to have plain text
huynhsontung Feb 5, 2021
53d9a3e
fix double pasting
huynhsontung Feb 5, 2021
275a87e
add sample code
huynhsontung Feb 5, 2021
be6f402
handle duplicate links + some refactoring
huynhsontung Feb 6, 2021
a4fd239
fix some bugs when pasting
huynhsontung Feb 6, 2021
67583c0
move to Microsoft.Toolkit.Uwp.UI.Controls.Input
huynhsontung May 1, 2021
418a646
unregister events before registering
huynhsontung May 1, 2021
8e2a7ac
remove copy of DefaultRichEditBoxStyle
huynhsontung May 1, 2021
79d1755
handle removing token at position 0 special case
huynhsontung May 16, 2021
1d3cfc8
handle rare case where link not updating
huynhsontung May 18, 2021
723824b
add Ctrl + Tab to commit
huynhsontung May 18, 2021
08b48e3
allow empty prefixes
huynhsontung May 18, 2021
557657b
add more formatting options
huynhsontung May 18, 2021
eab2cc8
forgot to set _ignoreChange
huynhsontung May 18, 2021
03a40ed
remove redundant ApplyDefaultFormatToRange
huynhsontung May 18, 2021
91c8cfc
fix suggestion refresh unnecessarily when text composition changes
huynhsontung May 19, 2021
a38d1e5
remove unused TextControlCommandBarFlyouts
huynhsontung May 19, 2021
4983b0e
refactor
huynhsontung Jun 1, 2021
5be33ce
add key to default RichSuggestBox style
huynhsontung Jun 2, 2021
68a17e2
no enforcing non-empty prefix
huynhsontung Jun 26, 2021
fda6c40
add tab key to select token + fix properly invalidate tokens
huynhsontung Jul 5, 2021
7876aa9
add TokenSelected event + some renaming
huynhsontung Jul 6, 2021
a3faee9
expose SelectionChanged event + bug fixes
huynhsontung Jul 8, 2021
13747b1
token background: transparent; foreground: HyperlinkButtonForeground
huynhsontung Jul 9, 2021
2387ba3
add more features to RichSuggestBox sample
huynhsontung Jul 9, 2021
2ac3e4f
added TokenHovered event and some refactoring
huynhsontung Jul 12, 2021
b150736
update sample to use TokenHovered
huynhsontung Jul 12, 2021
9d66f1a
better way to handle on hovered position
huynhsontung Jul 13, 2021
7c7c290
take into account scrollviewer offsets when calculating positions
huynhsontung Jul 14, 2021
6e4fb90
rework undo group handling
huynhsontung Jul 16, 2021
76e7c88
fix some bugs when there is a token at the start of the document
huynhsontung Jul 17, 2021
becfc10
miss 1 InvokeTokenSelected invocation
huynhsontung Jul 17, 2021
6e2d6f2
add synchronization for token dict
huynhsontung Jul 18, 2021
b36c283
pass ITextCharacterFormat to user instead of using custom RichSuggest…
huynhsontung Jul 19, 2021
70e7a41
reset formatting on text change that contains a token at range start
huynhsontung Jul 19, 2021
02f1076
minor tweaks
huynhsontung Jul 20, 2021
6686e74
add tests
huynhsontung Jul 20, 2021
8f10e3b
pad token with Zero-Width-Spaces to avoid character format "bleed"
huynhsontung Jul 20, 2021
6e53a50
update test for padding
huynhsontung Jul 20, 2021
17e3399
try to fix test App not running on CI
huynhsontung Jul 20, 2021
fd99d9d
delete text instead of resetting their character format
huynhsontung Jul 20, 2021
d6e64c1
add winui dependency in test app
huynhsontung Jul 27, 2021
169c716
update token list before triggering TextChanged
huynhsontung Jul 27, 2021
b13fc08
use content link foreground to avoid incompatible colors
huynhsontung Jul 30, 2021
2e7d978
update TestAdapter and TestFramework
huynhsontung Aug 5, 2021
2ab8096
temporarily remove tests
huynhsontung Aug 6, 2021
56104c1
TokenHovering event repeatedly fire on pointer moved
huynhsontung Aug 6, 2021
b25cdd5
use ignore attribute instead
huynhsontung Aug 6, 2021
be29388
refine hit test for TokenHovering
huynhsontung Aug 7, 2021
1c1c370
TokenHoveringEventArgs to include a PointerPoint object
huynhsontung Aug 7, 2021
e40e461
add richsuggestbox UI test
huynhsontung Aug 15, 2021
22cae50
test token text separate from item
huynhsontung Aug 15, 2021
1b2e483
test observale position
huynhsontung Aug 15, 2021
1f3dcc7
dont use UIElement.ActualSize
huynhsontung Aug 16, 2021
b39d0ba
modify size of suggestionsContainer instead of the actual listview
huynhsontung Aug 16, 2021
db0599a
retry adding unit tests
huynhsontung Aug 16, 2021
36f46be
Added license text
dpaulino Aug 16, 2021
c4f6009
ClearReferenceInfo
arcadiogarcia Aug 17, 2021
f458d51
Added unit tests
dpaulino Aug 18, 2021
bc95b9a
fix Tab key trap
huynhsontung Aug 18, 2021
0428550
TokenHovering -> TokenPointerOver
huynhsontung Aug 18, 2021
9195720
SuggestionsRequestedEventArgs should inherit DeferredEventArgs instead
huynhsontung Aug 18, 2021
a2b3880
rework SuggestionsRequested to support AdvancedCollectionView
huynhsontung Aug 19, 2021
d091e6a
protected LockObj -> private _tokensLock
huynhsontung Aug 19, 2021
9d4809c
trigger RichSuggestToken PropertyChanged individually
huynhsontung Aug 19, 2021
58a3cde
rename Query -> QueryText everywhere
huynhsontung Aug 19, 2021
c363f62
improve clarity for SuggestionChosenEventArgs
huynhsontung Aug 19, 2021
2ffd1ff
add header for RichSuggestQuery.cs
huynhsontung Aug 19, 2021
357d2ba
Wire up Unload event
XAML-Knight Aug 19, 2021
6787487
Removing "this." instances
shweaver-MSFT Aug 19, 2021
1ba3228
add Clear() and AddTokens() methods
huynhsontung Aug 19, 2021
b605154
Merge pull request #4173 from CommunityToolkit/shweaver/file-storage
michael-hawker Aug 19, 2021
17b9b32
reafactor out _suggestionRequestedCancellationSource
huynhsontung Aug 20, 2021
f772542
add Load() method
huynhsontung Aug 20, 2021
cddc5a6
add tests for Load and Clear
huynhsontung Aug 20, 2021
70c9ef0
minor fix for the Load test case
huynhsontung Aug 20, 2021
3587c40
SuggestionsRequested -> SuggestionRequested
huynhsontung Aug 20, 2021
73e5f15
update sample code bind
huynhsontung Aug 21, 2021
8eba48b
Fixed tests
dpaulino Aug 21, 2021
9b34912
improve some comments
huynhsontung Aug 22, 2021
32c3743
fix suggestions not showing if no SuggestionRequested handler
huynhsontung Aug 22, 2021
ad4fd04
Add ToCompositionString
arcadiogarcia Aug 22, 2021
7c205fe
Remove clearreferenceinfo
arcadiogarcia Aug 22, 2021
43975b7
Use invariant culture
arcadiogarcia Aug 22, 2021
ee71863
Reword comment
arcadiogarcia Aug 22, 2021
81b350e
Fix comment
arcadiogarcia Aug 22, 2021
f5a97d4
add icon for sample
huynhsontung Aug 23, 2021
ab1d3b3
improve sample icon
huynhsontung Aug 23, 2021
2e9b350
update code url for sample
huynhsontung Aug 23, 2021
7b7974b
update doc url for sample
huynhsontung Aug 23, 2021
d529d48
Added FrameworkElementExtension test
XAML-Knight Aug 23, 2021
94dc7bf
Update winui ref to 2.6.2
Rosuavio Aug 17, 2021
4bc7f21
Fix for ConstrainedBox test in high DPI
azchohfi Aug 23, 2021
cc562b3
Merge pull request #4191 from CommunityToolkit/constrainedBoxTestFix
azchohfi Aug 24, 2021
b2851d3
add test file, wip framework extension
XAML-Knight Aug 25, 2021
ab486ec
Initial attached shadow code
chris-blackman Jun 30, 2021
795c57e
Documentation update
chris-blackman Jul 6, 2021
5d1c7bf
Fixed member access
chris-blackman Jul 6, 2021
bb9dc4b
Move DropShadowPanel sample into shared folder and remove backing pag…
michael-hawker Aug 11, 2021
863e75c
Clean-up out-dated min version warnings on samples as the Toolkit min…
michael-hawker Aug 11, 2021
e3c6fe2
Move common Shadow base helpers to a folder in Uwp.UI
michael-hawker Aug 11, 2021
f2a8254
Move AttachedShadow to root namespace for Uwp.UI.Media
michael-hawker Aug 11, 2021
72d524c
Add Vector3 support for Sample Bindings
michael-hawker Aug 12, 2021
ed42e41
Add AttachedShadow Sample
michael-hawker Aug 12, 2021
f48df97
Clean-up some documentation and info about min version to sample app
michael-hawker Aug 13, 2021
75e53c9
Rename Shadows.Attached to Effects.Shadow
michael-hawker Aug 13, 2021
4a651dd
Add more samples (though one doesn't work for some reason with raw Bo…
michael-hawker Aug 13, 2021
2096e5d
Fix Border based Example
michael-hawker Aug 13, 2021
0459a89
Add initial Composition based AttachedDropShadow support
michael-hawker Aug 19, 2021
8647919
Add initial basic animation support for Shadows
michael-hawker Aug 23, 2021
ca6f772
Clean-up and simplify Shadow Animations, add support for animating al…
michael-hawker Aug 24, 2021
08ffdcf
Fix issues with XML documentation for new shadows feature
michael-hawker Aug 25, 2021
164eefd
Clean-up ShadowAnimation type and add rest of animatable properties
michael-hawker Aug 25, 2021
b34f441
Deprecate DropShadowPanel
michael-hawker Aug 25, 2021
83a5bce
Merge pull request #4182 from RosarioPulella/winui-2.6.2-preview
michael-hawker Aug 25, 2021
c932579
Update String to Vector Unit Tests to address new scenarios added in …
michael-hawker Aug 25, 2021
3d03ce7
dont use ApplicationView when XamlRoot is available
huynhsontung Aug 26, 2021
3401db0
disable element on screen check
huynhsontung Aug 26, 2021
4e327ed
Still apply Screen size algorithm for UWP and annotate calculation
michael-hawker Aug 26, 2021
d9e8845
Adding control size trigger (#3867)
Aug 26, 2021
46bd862
Provide better guards for UWP
michael-hawker Aug 26, 2021
fe9ac89
Implement RichSuggestBox (#3650)
Aug 26, 2021
88af510
Fix MVVM Toolkit source generator tests
Sergio0694 Aug 27, 2021
33bdd30
Enable source generator tests in CI
Sergio0694 Aug 27, 2021
5ab106e
Merge branch 'main' into ryken100/feature-AttachedShadows
michael-hawker Aug 27, 2021
f3b0e5c
Update Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Shadows/AttachedSh…
michael-hawker Aug 27, 2021
01c9fa3
Update Microsoft.Toolkit.Uwp.SampleApp/Common/Vector3Converter.cs
michael-hawker Aug 27, 2021
2404be9
Make field initialization static
michael-hawker Aug 27, 2021
e418928
Clean-up Shadow internal part usage based on @Sergio0694 PR comments
michael-hawker Aug 27, 2021
5d5d86f
Attached Shadows (Composition and Win2D + Animations) (#4179)
Aug 27, 2021
836a501
add design metadata for RichSuggestBox
huynhsontung Aug 28, 2021
a37860d
adjust category attributes
huynhsontung Aug 28, 2021
8fa7a8d
Applied the suggested name changes by @michael-hawker
COM8 Aug 28, 2021
a867fad
Removed the additional parentheses spotted by @XAML-Knight
COM8 Aug 28, 2021
02bbc4d
adjust category attribute
huynhsontung Aug 28, 2021
79f2931
Fix ColorPickerButton samples and switch to StackPanel
robloo Aug 29, 2021
9f20cf4
Merge branch 'master' into color-picker-fixes
robloo Aug 29, 2021
f606fa8
Update UI Test certificate, expires 8/30/2022
michael-hawker Aug 30, 2021
f9a80ec
Merge pull request #4204 from CommunityToolkit/fix-test-certs
michael-hawker Aug 30, 2021
10e7668
Merge pull request #4197 from COM8/feature/two_pane_view
michael-hawker Aug 30, 2021
5e4b0b8
Merge pull request #4023 from RosarioPulella/ilc-pageSize
michael-hawker Aug 30, 2021
4fd1609
Merge branch 'main' into color-picker-fixes
michael-hawker Aug 30, 2021
aecbcad
Merge pull request #4134 from robloo/color-picker-fixes
michael-hawker Aug 30, 2021
2b84917
Remove stale comment on attached shadow example
michael-hawker Aug 30, 2021
cf4122c
break main RichSuggestBox.cs into smaller files
huynhsontung Aug 30, 2021
ede46a3
abstract internal document edit into CreateSingleEdit
huynhsontung Aug 30, 2021
8c9890b
Apply WeakReference
XAML-Knight Aug 31, 2021
eff2ee5
Merge pull request #4200 from huynhsontung/rsb-metadata
michael-hawker Aug 31, 2021
cefaeeb
Improving ComboBoxColumn behavior to prevent need to click a ComboBox…
bolyb Aug 31, 2021
81504ce
Add extra requirements for controls to checklist
michael-hawker Aug 31, 2021
2f9a266
Added missing header
XAML-Knight Sep 1, 2021
58af745
Merge remote-tracking branch 'upstream/main' into rsb-reorganize
huynhsontung Sep 1, 2021
20c61f9
Convert Design projects to Sdk-style
Nirmal4G Feb 14, 2021
ea41b48
Build Design project's parent when not under solution build
Nirmal4G Feb 14, 2021
67f3906
Add Design project for the UWP Media controls
Nirmal4G Feb 14, 2021
8d0d473
Fixed [ObservableProperty] for fields named "value"
Sergio0694 Sep 2, 2021
166e101
Merge pull request #4203 from huynhsontung/rsb-reorganize
michael-hawker Sep 2, 2021
e4b8a68
Merge pull request #4219 from Sergio0694/bugfix/value-named-generated…
michael-hawker Sep 2, 2021
8273bca
Update Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridCo…
michael-hawker Sep 2, 2021
0ee2c84
Merge pull request #4220 from bolyb/combobox-triple-click-fix
michael-hawker Sep 2, 2021
cc2a51e
fix: Prevent focus reset for DataGridTemplateColumn
lukeblevins Jul 30, 2021
99d587f
Enhance DataGrid Sample
michael-hawker Sep 2, 2021
e89cac6
Add PreparingCellForEdit example to open CalendarDropDown on 2nd click
michael-hawker Sep 2, 2021
20f951e
Merge pull request #4101 from chingucoding/dev/tokenizingtextbox-head…
michael-hawker Sep 2, 2021
9cf1630
Add comment about DateTimeOffset binding from #2493 comment
michael-hawker Sep 3, 2021
3f29bde
fix: Prevent focus reset for DataGridTemplateColumn (#4206)
Sep 3, 2021
c5b2bb7
Place DP props on one line
XAML-Knight Sep 3, 2021
9f8527c
UITests: Remove ref to incorrect version of winui
Rosuavio Sep 3, 2021
984fe18
Merge pull request #4226 from RosarioPulella/fix/uitest-winui-version
michael-hawker Sep 3, 2021
0ce4553
Merge pull request #4198 from Sergio0694/testing/mvvm-toolkit-sg
Sergio0694 Sep 3, 2021
55316d4
Remove blank line
XAML-Knight Sep 7, 2021
762818c
Add test for grid unload
XAML-Knight Sep 8, 2021
fb5b405
Fix #4214 - Update AttachedDropShadow visual when element layout chan…
michael-hawker Sep 8, 2021
21e0825
Added diagnostic for unsupported C# language version
Sergio0694 Sep 8, 2021
15a26e4
Added unit tests for new diagnostic
Sergio0694 Sep 8, 2021
cd475a3
Apply Await
XAML-Knight Sep 8, 2021
b276329
Merge pull request #3794 from Nirmal4G/feature/design-tools
michael-hawker Sep 8, 2021
8d7f8c2
Merge pull request #4231 from Sergio0694/feature/csharp-version-diagn…
michael-hawker Sep 8, 2021
27c302f
Aid the unload effort
XAML-Knight Sep 9, 2021
b6ec0bc
Merge pull request #4230 from michael-hawker/shadow-events
michael-hawker Sep 9, 2021
5dfc575
Merge pull request #4189 from arcadiogarcia/user/arcadiog/ToCompositi…
michael-hawker Sep 9, 2021
1206930
Test added to proj
XAML-Knight Sep 9, 2021
669c355
Merge remote-tracking branch 'XAML-Knight/dev/AncestorTheUnloaded' in…
XAML-Knight Sep 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ What kind of change does this PR introduce?
Please check if your PR fulfills the following requirements: <!-- and remove the ones that are not applicable to the current PR -->

- [ ] Tested code with current [supported SDKs](../#supported)
- [ ] Pull Request has been submitted to the documentation repository [instructions](../blob/main/Contributing.md#docs). Link: <!-- docs PR link -->
- [ ] New component
- [ ] Pull Request has been submitted to the documentation repository [instructions](../blob/main/Contributing.md#docs). Link: <!-- docs PR link -->
- [ ] Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
- [ ] If control, added to Visual Studio Design project
- [ ] 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/CommunityToolkit/WindowsCommunityToolkit-design-assets)
- [ ] 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...
Expand All @@ -51,4 +54,4 @@ Please note that breaking changes are likely to be rejected within minor release

## Other information

<!-- Please add any other information that might be helpful to reviewers. -->
<!-- Please add any other information that might be helpful to reviewers. -->
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ MVVMTK0009 | Microsoft.Toolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator
MVVMTK0010 | Microsoft.Toolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator | Error | See https://aka.ms/mvvmtoolkit/error
MVVMTK0011 | Microsoft.Toolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator | Error | See https://aka.ms/mvvmtoolkit/error
MVVMTK0012 | Microsoft.Toolkit.Mvvm.SourceGenerators.ICommandGenerator | Error | See https://aka.ms/mvvmtoolkit/error
MVVMTK0013 | Microsoft.CodeAnalysis.CSharp.CSharpParseOptions | Error | See https://aka.ms/mvvmtoolkit/error
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public void Execute(GeneratorExecutionContext context)
return;
}

// Validate the language version. Note that we're emitting this diagnostic in each generator (excluding the one
// only emitting the nullability annotation attributes if missing) so that the diagnostic is emitted only when
// users are using one of these generators, and not by default as soon as they add a reference to the MVVM Toolkit.
// This ensures that users not using any of the source generators won't be broken when upgrading to this new version.
if (context.ParseOptions is not CSharpParseOptions { LanguageVersion: >= LanguageVersion.CSharp9 })
{
context.ReportDiagnostic(Diagnostic.Create(UnsupportedCSharpLanguageVersionError, null));
}

// Sets of discovered property names
HashSet<string>
propertyChangedNames = new(),
Expand Down Expand Up @@ -240,6 +249,14 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
}
}

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

BlockSyntax setterBlock;

if (validationAttributes.Count > 0)
Expand All @@ -263,10 +280,10 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(

// Generate the inner setter block as follows:
//
// if (!global::System.Collections.Generic.EqualityComparer<<FIELD_TYPE>>.Default.Equals(<FIELD_NAME>, value))
// if (!global::System.Collections.Generic.EqualityComparer<<FIELD_TYPE>>.Default.Equals(this.<FIELD_NAME>, value))
// {
// OnPropertyChanging(global::Microsoft.Toolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.PropertyNamePropertyChangingEventArgs); // Optional
// <FIELD_NAME> = value;
// this.<FIELD_NAME> = value;
// OnPropertyChanged(global::Microsoft.Toolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.PropertyNamePropertyChangedEventArgs);
// ValidateProperty(value, <PROPERTY_NAME>);
// OnPropertyChanged(global::Microsoft.Toolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedOrChangingArgs.Property1PropertyChangedEventArgs); // Optional
Expand All @@ -291,7 +308,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
IdentifierName("Default")),
IdentifierName("Equals")))
.AddArgumentListArguments(
Argument(IdentifierName(fieldSymbol.Name)),
Argument(fieldExpression),
Argument(IdentifierName("value")))),
Block(
ExpressionStatement(
Expand All @@ -303,7 +320,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
ExpressionStatement(
AssignmentExpression(
SyntaxKind.SimpleAssignmentExpression,
IdentifierName(fieldSymbol.Name),
fieldExpression,
IdentifierName("value"))),
ExpressionStatement(
InvocationExpression(IdentifierName("OnPropertyChanged"))
Expand Down Expand Up @@ -346,7 +363,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
ExpressionStatement(
AssignmentExpression(
SyntaxKind.SimpleAssignmentExpression,
IdentifierName(fieldSymbol.Name),
fieldExpression,
IdentifierName("value"))),
ExpressionStatement(
InvocationExpression(IdentifierName("OnPropertyChanged"))
Expand Down Expand Up @@ -384,7 +401,7 @@ private static PropertyDeclarationSyntax CreatePropertyDeclaration(
IdentifierName("Default")),
IdentifierName("Equals")))
.AddArgumentListArguments(
Argument(IdentifierName(fieldSymbol.Name)),
Argument(fieldExpression),
Argument(IdentifierName("value")))),
updateAndNotificationBlock));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.Toolkit.Mvvm.SourceGenerators.Extensions;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Microsoft.Toolkit.Mvvm.SourceGenerators.Diagnostics.DiagnosticDescriptors;

namespace Microsoft.Toolkit.Mvvm.SourceGenerators
{
Expand All @@ -39,6 +40,12 @@ public void Execute(GeneratorExecutionContext context)
return;
}

// Validate the language version
if (context.ParseOptions is not CSharpParseOptions { LanguageVersion: >= LanguageVersion.CSharp9 })
{
context.ReportDiagnostic(Diagnostic.Create(UnsupportedCSharpLanguageVersionError, null));
}

// Get the symbol for the ValidationAttribute type
INamedTypeSymbol validationSymbol = context.Compilation.GetTypeByMetadataName("System.ComponentModel.DataAnnotations.ValidationAttribute")!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Microsoft.Toolkit.Mvvm.SourceGenerators.Extensions;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle;
using static Microsoft.Toolkit.Mvvm.SourceGenerators.Diagnostics.DiagnosticDescriptors;

namespace Microsoft.Toolkit.Mvvm.SourceGenerators
{
Expand Down Expand Up @@ -67,6 +68,12 @@ public void Execute(GeneratorExecutionContext context)
return;
}

// Validate the language version
if (context.ParseOptions is not CSharpParseOptions { LanguageVersion: >= LanguageVersion.CSharp9 })
{
context.ReportDiagnostic(Diagnostic.Create(UnsupportedCSharpLanguageVersionError, null));
}

// Load the syntax tree with the members to generate
SyntaxTree sourceSyntaxTree = LoadSourceSyntaxTree();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System.ComponentModel;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

namespace Microsoft.Toolkit.Mvvm.SourceGenerators.Diagnostics
{
Expand Down Expand Up @@ -201,7 +202,23 @@ internal static class DiagnosticDescriptors
category: typeof(ICommandGenerator).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: $"Cannot apply [ICommand] to methods with a signature that doesn't match any of the existing relay command types.",
description: "Cannot apply [ICommand] to methods with a signature that doesn't match any of the existing relay command types.",
helpLinkUri: "https://aka.ms/mvvmtoolkit");

/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> indicating when an unsupported C# language version is being used.
/// <para>
/// Format: <c>"The method {0}.{1} cannot be used to generate a command property, as its signature isn't compatible with any of the existing relay command types"</c>.
/// </para>
/// </summary>
public static readonly DiagnosticDescriptor UnsupportedCSharpLanguageVersionError = new(
id: "MVVMTK0013",
title: "Unsupported C# language version",
messageFormat: "The source generator features from the MVVM Toolkit require consuming projects to set the C# language version to at least C# 9.0",
category: typeof(CSharpParseOptions).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "The source generator features from the MVVM Toolkit require consuming projects to set the C# language version to at least C# 9.0. Make sure to add <LangVersion>9.0</LangVersion> (or above) to your .csproj file.",
helpLinkUri: "https://aka.ms/mvvmtoolkit");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public void Execute(GeneratorExecutionContext context)
return;
}

// Validate the language version
if (context.ParseOptions is not CSharpParseOptions { LanguageVersion: >= LanguageVersion.CSharp9 })
{
context.ReportDiagnostic(Diagnostic.Create(UnsupportedCSharpLanguageVersionError, null));
}

foreach (var items in syntaxReceiver.GatheredInfo.GroupBy<SyntaxReceiver.Item, INamedTypeSymbol>(static item => item.MethodSymbol.ContainingType, SymbolEqualityComparer.Default))
{
if (items.Key.DeclaringSyntaxReferences.Length > 0 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.Toolkit.Mvvm.SourceGenerators.Extensions;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Microsoft.Toolkit.Mvvm.SourceGenerators.Diagnostics.DiagnosticDescriptors;

namespace Microsoft.Toolkit.Mvvm.SourceGenerators
{
Expand All @@ -38,6 +39,12 @@ public void Execute(GeneratorExecutionContext context)
return;
}

// Validate the language version
if (context.ParseOptions is not CSharpParseOptions { LanguageVersion: >= LanguageVersion.CSharp9 })
{
context.ReportDiagnostic(Diagnostic.Create(UnsupportedCSharpLanguageVersionError, null));
}

// Get the symbol for the IRecipient<T> interface type
INamedTypeSymbol iRecipientSymbol = context.Compilation.GetTypeByMetadataName("Microsoft.Toolkit.Mvvm.Messaging.IRecipient`1")!;

Expand Down
Loading