Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[CSS] allow mapping css prop to multiple BPs#3437

Merged
StephaneDelcroix merged 1 commit intomasterfrom
css_1tomany
Jul 31, 2018
Merged

[CSS] allow mapping css prop to multiple BPs#3437
StephaneDelcroix merged 1 commit intomasterfrom
css_1tomany

Conversation

@StephaneDelcroix
Copy link
Copy Markdown
Member

@StephaneDelcroix StephaneDelcroix commented Jul 30, 2018

Description of Change

To allow mapping a single CSS property to multiple controls, we so far
relied on extracting the BindableProperties to static helper classes,
and implementing an interface for accessors, and eventually change
handlers.

That extraction works well, and is actually a good pattern, as long as:

  • the extracted BPs share the same PropertyName,
  • default value, and
  • return type, obiously

As the CSS color property has to map to both TextColor and Color
BPs, the property extraction wasn't possible.

This change adds the capability to map a single CSS property to
multiples BPS, when extraction isn't possible. Whenever the extraction
to an interface is possible, that behavior is strongly encouraged.

As an example of the usage of this feature, this allows the ActivityIndicator.Color to be styled by CSS

Issues Resolved

/

API Changes

/

Platforms Affected

  • Core/XAML (all platforms)

Behavioral/Visual Changes

/

PR Checklist

  • Has automated tests
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

To allow mapping a single CSS property to multiple controls, we so far
relied on extracting the BindableProperties to static helper classes,
and implementing an interface for accessors, and eventually change
handlers.

That extraction works well, and is actually a good pattern, as long as:
 - the extracted BPs share the same PropertyName,
 - default value, and
 - return type, obiously

As the CSS `color` property has to map to both `TextColor` and `Color`
BPs, the property extraction wasn't possible.

This change adds the capability to map a single CSS property to
multiples BPS, when extraction isn't possible. Whenever the extraction
to an interface is possible, that behavior is strongly encouraged.
@xamarin-release-manager xamarin-release-manager added the API-change Heads-up to reviewers that this PR may contain an API change label Jul 30, 2018
@StephaneDelcroix StephaneDelcroix added a/CSS t/enhancement ➕ API-change Heads-up to reviewers that this PR may contain an API change and removed API-change Heads-up to reviewers that this PR may contain an API change labels Jul 30, 2018
@kingces95
Copy link
Copy Markdown
Contributor

That'll do it, alright.

@kingces95 kingces95 mentioned this pull request Jul 30, 2018
3 tasks
@StephaneDelcroix StephaneDelcroix merged commit a2b8361 into master Jul 31, 2018
@StephaneDelcroix StephaneDelcroix deleted the css_1tomany branch July 31, 2018 07:18
PureWeen pushed a commit that referenced this pull request Aug 28, 2018
To allow mapping a single CSS property to multiple controls, we so far
relied on extracting the BindableProperties to static helper classes,
and implementing an interface for accessors, and eventually change
handlers.

That extraction works well, and is actually a good pattern, as long as:
 - the extracted BPs share the same PropertyName,
 - default value, and
 - return type, obiously

As the CSS `color` property has to map to both `TextColor` and `Color`
BPs, the property extraction wasn't possible.

This change adds the capability to map a single CSS property to
multiples BPS, when extraction isn't possible. Whenever the extraction
to an interface is possible, that behavior is strongly encouraged.
@samhouts samhouts modified the milestone: 3.2.0 Sep 11, 2018
@samhouts samhouts added this to the 3.3.0 milestone Sep 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a/CSS API-change Heads-up to reviewers that this PR may contain an API change t/enhancement ➕

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants