Conversation
StephaneDelcroix
left a comment
There was a problem hiding this comment.
cosmetic changes, then it's 👍
| { | ||
| if (target == null) | ||
| throw new ArgumentNullException(nameof(target)); | ||
| var targetObject = FindTargetObject(scope, TargetName); |
There was a problem hiding this comment.
I think the FindTargetObject doesn't bring enough value by itself
if (target == null) throw...;
if (!string.IsNullOrEmpty(TargetName) && target is Element element)
target == element.FindByName(TargetName) as BindableObject ?? throw ...;There was a problem hiding this comment.
I think I implemented the way you intended, if I missed anything please let me know :)
|
please target 4.4.0 |
Include unit and xaml unit tests corrected naming to prevent issues Updating xamlc is still outstanding
|
🤦♂ done! |
|
Does this support property paths? For example: I have an app that actually does this: https://gist.github.com/mattleibow/2f2f33c353be0b33e31bf9007095b105#file-mainpage-xaml-L35-L41 |
That is pretty awesome :) Just tried it with this PR and that doesn't work. XamlC falls over it, and even when I disable that it won't work. In addition I tried it with another path like Would it make sense to get this in first as a start and then build from there? |
|
That seems like something g that we can do still. I can always name things a bit more for now. Good work so far. Gonna be nice to write less VSM per element :) |
Description of Change
Adds the ability to target a child object by name for a Setter for visual state management or styles.
Issues Resolved
API Changes
Added:
public string TargetName { get; set; }Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
Not applicable
Testing Procedure
I've added a core gallery page
VisualStateSetterTarget.xamlwhich has a button to toggle the VSM state of theStackLayout. When it's pressed, theALabelis also triggered because of it's reference throughTargetName.PR Checklist