enisn / Xamarin.Forms.InputKit

CheckBox, Radio Button, Labeled Slider, Dropdowns etc.
MIT License
588 stars 100 forks source link

There is no databinding for checkbox in listview header #232

Open ramu0815 opened 2 years ago

ramu0815 commented 2 years ago

Hi, right now I' strungeling with a Xarmarin project. I have defined a grouped listview in xaml file. Placing the checkbox in the DataTemplate of ListView.GroupHeaderTemplate section there is no binding data aviable at the CheckChanged routine. ob is null!

Moving the checkbox to the there will be a binding in the routine.

Not quite sure how to use checkbox in grouped listviews fpr the grouped item??

Checkbox definition <controls:CheckBox VerticalOptions="Start" x:Name="Checkbox" Grid.Column="0" TextColor="Blue" IsChecked="{Binding IsChecked, Mode=TwoWay}" WidthRequest="100" Text="{Binding KeyWithCount}" Key="{Binding .}"
CheckChanged="Checkbox_CheckedChanged"/>

void Checkbox_CheckedChanged(object sender, EventArgs e) { var checkbox = (Plugin.InputKit.Shared.Controls.CheckBox)sender; var ob = checkbox.BindingContext ; }

enisn commented 2 years ago

I think it's related to Xamarin Forms data binding system. The InputKit Checkbox doesn't do anything special for binding.

If you provide more info like your ViewModel, i can investigate but as I say, there is no special implementation in Checkbox for data binding