-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Mutable and subclassable version of ObservableGroup #3526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutable and subclassable version of ObservableGroup #3526
Conversation
|
Thanks hansmbakker for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks good, though this change makes me wonder whether we should really consider moving all these types directly into the MVVM Toolkit, as in particular with this change, these are really just MVVM-specific collection types. I mean I really can't think of a reason why anyone would want to use these types (or even just ObservableCollection<T> too) if not in a MVVM application - the whole point of these collections is that they're observable, as they implement both INotifyPropertyChanged and INotifyCollectionChanged.
@michael-hawker With the MVVM Toolkit being added in the 7.0 release, should we consider just moving these types over there instead? I mean, all the rest of the base Microsoft.Toolkit has nothing related to MVVM, while the MVVM Toolkit is entirely dedicated to it - I feel like these observable collections types are a bit the odd ones out just being in the base package?
Thoughts? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with @Sergio0694 suggestions 👍
Co-authored-by: Sergio Pedri <[email protected]>
|
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
Co-authored-by: Sergio Pedri <[email protected]>
Co-authored-by: Sergio Pedri <[email protected]>
|
Thank you for the suggestions @Sergio0694 ! Those were really helpful. I was not aware of those conventions; VS must have picked up my own project's editorconfig settings when I added the |
Totally agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after these last 3 small changes 🚀
We can talk about possibly moving these APIs later on but the PR is alright as is, since all these APIs are aalready available in the base package anyway, so that's not an issue to merge this first.
|
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
Is this a convention? Or another reason? In https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/634e243809b964700d736bbb9bae1f7b8efa464a/Microsoft.Toolkit.Mvvm/Input/AsyncRelayCommand.cs I see things above and below the constructor. In ObservableGroup everything was below the constructor? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 🚀
|
Hello @Sergio0694! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Yup, generally speaking we follow this structure:
Of course, there might be some very specific exceptions, eg. static throw helper methods should always just go at the bottom of a type, or fields that back an instance property with both a getter and a setter should be declared right above the corresponding property. I feel like following this pattern helps a lot to improve consistency and keep the code easier to read 😊 |
|
@Sergio0694 thank you for the quick iterations and helpful comments! |
|
Of course, happy to help! 😄 Thanks for the PR! 🚀 |
Fixes #3519
Removes two restrictions from
ObservableGroupto make it usable in more situations. In my case, I wanted to be able to rename the groups (for this I needed a mutable key), and I wanted to add properties on the group level (I needed to unseal it)Keyproperty and makes theKeyproperty observable.sealedkeyword fromObservableGroupPR Type
What kind of change does this PR introduce?
What is the current behavior?
ObservableGrouphas an immutableKeypropertyObservableGroupis not inheritableWhat is the new behavior?
ObservableGrouphas a mutableKeypropertyObservableGroupis inheritablePR Checklist
Please check if your PR fulfills the following requirements:
Other information