Better support for notifying cascading calculated properties #857
Labels
feature request 📬
A request for new changes to improve functionality
mvvm-toolkit 🧰
Issues/PRs for the MVVM Toolkit
Overview
I have a particularly complex scoring UI that I'm trying to model which has a number of inputs (in the 15-20 input range per side, and there are 2 sides in each match). These inputs then cascade into a dozen outputs from the match, all of which I would like to display in the UI. Further, these outputs often influence each other. As a concrete example:
These calculations are easier to display to the user broken up, rather than just "here's the final value". For example, we display both the number of total game pieces scored across all components, as well as the final score. However, because each of these inputs can have multiple cascading impacts (scoring in a single location impacts total number of items scored, which impacts total number of points), I have to do a lot of
NotifyPropertyChangedFor
duplication across all of these inputs. I would prefer to annotate the calculated properties with what they themselves will cause to change; then all I have to do is annotate the inputs with the outputs they directly impact, and let secondary impacts be sorted out through a graph walk by the source generator.API breakdown
No new APIs are necessary. Just add
AttributeTargets.Property
toNotifyPropertyChangedFor
, and update the source generator to understand that it should explore allNotifyPropertyChangedFor
properties for cascaded properties.Usage example
A very simplified example. Note that this sample is missing several inputs to the calculated properties I'm showing.
Breaking change?
No
Alternatives
Currently, I just have to duplicate these
NotifyPropertyChangedFor
across all the inputs. It's a lot of duplication, and is very fragile. I don't want to maintain it 🙂.Additional context
No response
Help us help you
No, just wanted to propose this
The text was updated successfully, but these errors were encountered: