-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Enhancement] Add a way to get properties from the Core #1418
Comments
This might be a bit hard to do since BindableObject only lives in the Controls layer, so it will only be able to exist there. Comet does not use Controls so I am not sure how this could be implemented at a Core layer. If we have it add Core, does Comet have a property bag that we can just pull from? If so, then it might work. But, another issue is that with Controls, we use BindableProperty - which appears to be string based, but is actually an object instance. Se we can't do |
Comet already has this, you can just do |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
@jonathanpeppers before we even think this, I feel this will be even more string-y... Any trimming/AOT thoughts on this one? |
If
It would have to iterate over the keys until it found a match. This overhead doesn't seem like a great plan to me. Overall, I'm not a fan of the handlers, in general:
|
Didn't they make a fast read only dictionary we could maybe switch to... Also, this may be restricted to attached properties as there is not really a way to get things since it is not actually part of the view. |
Frozen collections are slower to create but faster to access. You'd need to do the startup cost / runtime benefit, to see if that would help handlers. |
Summary
The Handlers each have a static dictionary that will allow you to specify a Property name to add a Mapper of something to do when the value has been updated on a given control. However when working with these mappers you ultimately are dealing with an ILabel, IButton, etc. As a result you cannot access attached properties on the control from the core level. As a result in order to make use of this a Library developer would have to duplicate logic across Comet and Maui to support both design patterns. Since both Maui and Comet ultimately contain a dictionary on the controls, this should be easily achievable by exposing some method on a base class to access values for any given property name from a Core context.
API Changes
With this implemented say on BindableObject, you could then update handlers like:
Intended Use Case
With something (and no I'm not tied to the name) like
IPropertyCollection
implemented on BindableObject, this would provide library authors the ability to write Property Mappers one time within a Core support library. This reduces the need for first implementing an Interface, and then providing a custom control that implements the interface, which then means that it would never be supported on Out-of-Box controls.Note that currently in order to achieve the desired effect extensions would need to be duplicated and cast the ILabel (or whatever) as the concrete implementation for Maui / Comet. Since both Comet and Maui controls are effectively Dictionaries, this approach would work very well, while providing flexibility to not work the same if some new implementation were introduced where all of the controls were records or something that might require reflection (per @Clancey).
The text was updated successfully, but these errors were encountered: