dimanche 26 juillet 2020

How to bind two things to IsChecked property of checkbox?

Ok, so I have a datagrid with a checkbox in a DataGridTemplateColumn since I would like to do a single-click check. I also have a "select all" checkbox at the top. (I disabled the header because I wanted to make a custom one). My datagrid is programmatically populated. and I'm using the mahApps nuget package (if that means anything).

What I want to do is bind the "Select All" status to the IsChecked property on my populated checkboxes but also be able to click the row to check the checkbox. But to be able to do that, I need to add: IsChecked="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsSelected, Mode=OneWay}".

I have both of them, and they both work, but I can only seem to use one at a time. How would I go about doing both? Please let me know if you need more info

Edit: I would also need multi-selection!




Aucun commentaire:

Enregistrer un commentaire