Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150675 | Jan 15,2020 07:22 PM UTC | Jan 23,2020 06:01 AM UTC | Xamarin.Forms | 5 |
![]() |
Tags: SfCheckBox |
Hi David,
Query: how
to initialize data binding in C#
We have prepared a simple sample to bind the properties of
SfCheckBox in code behind. Please refer the below code.
Code snippet [C#]:
var binding = new Binding() { Source = viewModel, Path = "IsActive", Mode =
BindingMode.TwoWay };
SfCheckBox sfCheckBox = new SfCheckBox(); sfCheckBox.SetBinding(SfCheckBox.IsCheckedProperty, binding); |
Sample - https://www.syncfusion.com/downloads/support/forum/150675/ze/150675-sample-365345168.zip
Please get back to us if you need further assistance on this.
Regards,
Geetha R.
foreach(Model model in viewModel.Data)
{
var binding = new Binding()
{
Source = model,
Path = "IsChecked",
Mode = BindingMode.TwoWay
};
Binding textbinding = new Binding()
{
Source = model,
Path = "Name",
Mode = BindingMode.TwoWay
};
SfCheckBox sfCheckBox = new SfCheckBox();
sfCheckBox.SetBinding(SfCheckBox.TextProperty, textbinding);
sfCheckBox.SetBinding(SfCheckBox.IsCheckedProperty, binding);
layout.Children.Add(sfCheckBox);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.