-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adding control size trigger #3867
Adding control size trigger #3867
Conversation
Thanks dpaulino 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 🙌 |
|
Thanks @dpaulino, I feel like we may have an issue somewhere open for this? I know it's been a long-standing 'to do' thing. 🙂 You can check-out the Wiki Page on Adding a Sample here too, we may also want to add tests for the triggers in our test suite. |
I took a glance at issues relating triggers but couldn't spot one. But I can try to look more carefully in a bit. Also, full credit goes to @rudyhuyn for creating this. With his permission, I merely volunteered to bring this to the toolkit. I'll work on the other pr requirements over the next few days. |
Cool, if it's @rudyhuyn's code, we should just get his buy-in on the PR even if it's just a comment saying he approves, it helps if he's signed the .NET Foundation CLA as well from the link above in the bot message. |
FYI there's also one in the platform samples apparently: https://github.com/microsoft/Windows-universal-samples/blob/master/Samples/XamlStateTriggers/cs/CustomTriggers/ControlSizeTrigger.cs (Thanks @Arlodotexe for the link). Do we want to worry about height too? Should it be combined or independent? Independent means you could have both triggers for the same state more easily, right? |
@dpaulino thoughts on the height? We also need docs and a unit test would probably be good? |
@dpaulino did you want to compare the implementations still and work on a quick test and sample for this still? |
@michael-hawker hey sorry for the radio silence! I think having a separate controlHeightTrigger class may be preferred. Might be clearer in usage to see separate triggers for width and for height. Thoughts? I'll try to make a sample for this soon, and yeah I can play around with the one from the official samples. If they perform similarly, what do you think is the best approach? Just c/p that code instead of using this one? |
@dpaulino having them combined as a single trigger I think would be preferable; as if they're separate triggers, you can only do OR for width/height. By having them combined, you have use && in the trigger logic if the dev sets a width and height. Then if they want an OR they just setup two separate copies of the trigger (one with Width and one with Height). See doc for StateTriggers as it'll apply is any trigger is matched. I like that yours has the min/max range style as well, so maybe a combination of both? As for adding a sample, we have a wiki doc here, but there's a ton of existing StateTrigger samples, so you can just copy one of those too as a starting point. |
…Toolkit-1 into feature/control-width-trigger
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
Oops sorry if I changed the reviewer! Not quite sure what happened! |
…Toolkit-1 into feature/control-width-trigger
@dpaulino missing the header on the new test file 😉 |
Would it make more sense to make the default values |
Yeah that makes sense. Let me make some changes |
@dotMorten the trigger now has double.NaN as default. Tests added as well to test the different scenarios. Thanks for the feedback. |
From @dotMorten:
@dpaulino wasn't this the case already as the default was Infinity? I'm confused. You should just be able to set We're concerned about the extra complexity in all the extra logic when it should have just worked as is? Also tests are failing in the CI:
|
@michael-hawker UGH I totally misread that. I could swear the default was |
Ok sounds good, I'll revert the change and fix the unit tests. |
79fba6b
to
f458d51
Compare
I reverted the change and fixed the unit tests. |
@michael-hawker The unit tests are passing for me locally, but the CI is failing. Is there something else I'm missing? |
CI build test passing, yay! |
Anything else I can do? |
Hello @michael-hawker! 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 (
|
Fixes
Adding a new visual state trigger which can be triggered based on a the width of a UI element rather than the width of the app's entire window.
PR Type
What kind of change does this PR introduce?
Feature
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:
Other information