Binding in ItemTemplate to "IsSelected" of the ListViewItem seems not to work

Hi,
I'm trying to bind a checkbox to the "IsSelected" property of the ListViewItem.

    <DataTemplate x:Key="Printer3dItemTemplate">
        <ViewCell>
            <ViewCell.View>
                 <buttons:SfCheckBox 
                        IsEnabled="False"
                        IsChecked="{Binding IsSelected, Source={x:RelativeSource AncestorType={x:Type listView:ListViewItem}, AncestorLevel=1}}"
                        >
                    </buttons:SfCheckBox>
               </ViewCell.View>
        </ViewCell>
</DataTemplate>

This template is assigned to the "ItemTemplate" & "SelectedItemTemplate" Property of my listview.
However the checkbox isn't be checked once the item is selected in the listview.

Thank you,
Andreas

2 Replies 1 reply marked as answer

AR Andreas Reitberger June 28, 2020 10:21 AM UTC

Nevermind, found the bug was caused by a custom control based on the "SfListView" control.


SS SaiGanesh Sakthivel Syncfusion Team June 29, 2020 12:54 PM UTC

Hi Andreas, 
 
Thank you for cotacting Syncfusion support. 
 
#Regarding Binding in ItemTemplate to "IsSelected" of the ListViewItem seems not to work. 
We would like to inform you that you can achieved your requirement by setting the IsSelected property of the listview to the IsChecked property of SfCheckBox. We have prepared the sample as per your requirement and attached in the following link for your reference. 
 
 
Please let us know if you have any concern.  
  
Regards,  
SaiGanesh Sakthivel 


Marked as answer
Loader.
Up arrow icon