Microsoft-ui-xaml: Proposal: Make isChecked of ToggleSplitButton a bindable property

Created on 3 Apr 2020  ·  14Comments  ·  Source: microsoft/microsoft-ui-xaml

Proposal: Make isChecked of ToggleSplitButton a bindable property

Summary

It should be possible to bind the isChecked property to another property (e.g. for two-way binding)

Rationale

  • The functionality of the binding currently has to be implemented manually
  • The ToggleButton class implements isChecked as a dependency property

Scope


| Capability | Priority |
| :---------- | :------- |
| isChecked should support bindings | Must |

Important Notes

Open Questions

feature proposal team-Controls

Most helpful comment

I am trying to figure out if this was intentional or accidental.

I would be surprised to learn that this had been a deliberate choice, feels like an accident that isChecked isn't already bindable.

All 14 comments

@adambarlow do you own this one ?

MUX_PROPERTY_NEEDS_DP_FIELD seems to be used incorrectly for this property. @jevansaks to confirm. I think this needs to be straight up dependency property that is public.

@ranjeshj You typed "@jevansa". Will let you correct it 🙂

Very weird, why is this not a public DP? Would changing that to a public DP be considered a breaking change here or can/should we change this now?

Very weird, why is this not a public DP? Would changing that to a public DP be considered a breaking change here or can/should we change this now?

This would be adding API, so I think this should be fine. @MikeHillberg to correct me if I am wrong.

Wouldn't mind working on this though would refer to @chingucoding in case he's already working on it/wants to.

Sure, you can go for it @FelixDev . Probably an easy issue to fix: Update IDL and maybe add a test to check that binding is working.

@FelixDev Please hold for the time being. I am trying to figure out if this was intentional or accidental.

x:Bind should work for this property too in the meantime, right?

@YuliKl took commanding some time ago, but I can help if you have a specific question from me.

I am trying to figure out if this was intentional or accidental.

I would be surprised to learn that this had been a deliberate choice, feels like an accident that isChecked isn't already bindable.

@FelixDev confirmed that this was accidental. Please feel free to go ahead with the change. Thanks!

@ranjeshj Alright 🙂

I did some testing locally and I noticed that binding in XAML (two-way binding,...) already works. As in

<muxc:ToggleSplitButton x:Name="BindingToggleSplitButton" Content="IsChecked" IsChecked="{Binding IsChecked, Mode=TwoWay}"/>

where IsChecked is a public property of the DataContext. We still need to expose the DP in order to set it via

BindingToggleSplitButton.SetValue(ToggleSplitButton.IsCheckedProperty, true);
Was this page helpful?
0 / 5 - 0 ratings