lundi 12 octobre 2020

Telerik Grid: Checkbox in column header triggers "sometimes"

The strangest thing is happening with my GridView when I try to add a custom datacolumn with a checkbox in and a GridViewColumn.Header, to add anothner checkbox, that should select all checkboxes in the list, pretty standard.

I have the code below, but when I click the "check all"-checkbox, I do not get the Command send to my event handler, nothing happens. Now the strange part

If I, while running the application, change the markup (below) AncestorType={x:Type UserControl}}, to AncestorType={x:Type local:MyView}} it works, I get my event. Hip horray, right? Nope. If I restart the application, nothing happens again, until I change it back to the original and things are working again

...so to clarify, both versions ofAncestorType works, (my view and UserContro), but I need to touch the file at runtime to get the Command to trigger. I have also a Button that triggers that Command everytime, like a champ

snippet below:

<telerik:GridViewColumn  >
    <telerik:GridViewColumn.Header>
        <CheckBox IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.IsAllChecked, Mode=TwoWay}"                                                                                   
                    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectAllRowsCommand}">
              

        </CheckBox>
    </telerik:GridViewColumn.Header>
...



Aucun commentaire:

Enregistrer un commentaire