-
Notifications
You must be signed in to change notification settings - Fork 1.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
[Feature] Custom StateTriggerBase to include an IsActive bool dependency property #4428
Comments
Hello, 'XAML-Knight! Thanks for submitting a new feature request. I've automatically added a vote 👍 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future! |
Will need to name it something else to avoid confusing with the platform |
Linking microsoft/microsoft-ui-xaml#1460 |
Should be noted that |
The intended usage is that that is how you trigger that specific trigger - by setting it to true. It might have been more clear if it was called |
We're creating our own base class for the toolkit that has this property to reduce the copy-pasted boilerplate code for our own triggers, as described at the top of the issue. When WinUI figures their side out, we'll revisit our version and update as needed. |
I'm not entirely sure I understand the problem with allowing it to be publicly settable. |
For |
These are the "details to iron out" I mentioned 🙂 Setting However, the main point of exposing |
I think the original intent and problem microsoft/microsoft-ui-xaml#1460 is describing is not around trying to override the So, maybe this is a read-only DP that our own triggers can maintain the state in-sync with when they set the base Adding over-ride logic to each and every trigger we make seems a bit complex. I think that's what @dotMorten is trying to get at here. |
I don't think we need this at all, setting IsActive just activates or deactivates the trigger temporarily. But thinking through the possible scenarios the setter could be used for -- making it readonly sounds good. |
Which is what my proposed design suggests. Subclasses like the |
@XAML-Knight I'm curious about this justification:
Why are the triggers doing this in the first place? |
Should be noted that users can still set IsActive since dependency properties aren't truly readonly in UWP. Maybe still handle the changed callback and |
I have to agree with @michael-hawker's comment in the WinUI issue, maybe |
@Arlodotexe As already noted here: microsoft/microsoft-ui-xaml#1460 (comment) Since the |
Again as noted in the other issue, that would be a breaking change. Secondly there are different purposes to the two. They aren't the same thing, and shouldn't be merged, as they serve different purposes. Having IsActive settable on the base class would be a huge problem for all other state triggers, as they would no longer have control over when they are active or not. |
@Arlodotexe You thumbed my comment down. Do you care to explain why? Is there something the community toolkit can do here about a class that is defined in a completely different product, or am I misunderstanding something else that you want the community toolkit to do? |
We aren't trying to replace the inbox The thumb down was about closing the issue based on your linked comment - much of our discussion here has been to address that specific comment. |
@Arlodotexe Gotcha. I misunderstood the bit about introducing a second base class. |
Actually just looked at all the state triggers in this repo. Not a single one I can see has an
|
In my case, with Another trigger, |
Did you see my comment in your PR about just calling |
I'd suggest you take a second look at the |
@XAML-Knight the
This new base would allow us to refactor this. But it's doing it for the same reason so the state can be inspected from the outside vs. manipulating its logic. Also, we're not arguing, we're having a discussion. If you feel otherwise, please let me know. I think the main point (which we probably want to update in the issue description) is that we want to have the following:
I know normally we don't implement INotifyPropertyChange at the UI layer but maybe that's easier as dependency properties in UWP don't support read-only like WPF did (see microsoft/microsoft-ui-xaml#3139). |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the problem this feature would solve
A few of our triggers use their own
IsActive
Dependency Property, and so it seems like refactoring the bool property (as useful as it is) into the parent base class (StateTriggerBase
) would be in order.Describe the solution
StateTriggerBase
would be the proud new parent of a boolIsActive
dependency property (and potentially also an OnActiveChanged event), which would then be inherited by any subsequent child classes.Describe alternatives you've considered
Repeatedly adding the same boilerplate IsActive dependency property code to each trigger that needs it is not sustainable.
Additional context & Screenshots
Take a look at #1460
The text was updated successfully, but these errors were encountered: