Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Binding values in custom ViewCell

$
0
0

Hi All,

I have to identify which Switch control was toggled to get the Id of the corresponding row. So far I have this kind of implementation which is working as I want, but it is not elegant in my opinion. Any ideas how to make it better.

        `Label idLabel = new Label(){};
        idLabel.SetBinding(Label.TextProperty, "Id");

        idLabel.IsVisible = false;

        switcher.Toggled += (sender, e) => 
        {
            Console.WriteLine(idLabel.Text + " switch to " + e.Value);
        };
        mainGrid.Children.Add(idLabel, 0, 0);`

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>