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

How to access the ListView in Viewcell c# code behind ?

$
0
0

Actually I want to bind my IValueConverter with the StackLayout the code behind is

There's my ListView in CommentsPage i.e.,
public class CommentsPage : ContentPage
{

_commentsList.ItemTemplate = new DataTemplate(typeof(CommentsCell));

}

Also there's my CommentsCell that's another class .

public class CommentsCell : ViewCell
{

        ContentView mainLayout = new ContentView
        {

            Padding = new Thickness(1,0,1,0),
            BackgroundColor = Color.White,
            HorizontalOptions = LayoutOptions.StartAndExpand,
            VerticalOptions  = LayoutOptions.StartAndExpand,
            WidthRequest = _screenWidth
        };
        mainLayout.SetBinding(VisualElement.BackgroundColorProperty, new Binding(".", BindingMode.Default, new isFirstOrLastColorConverter(),
            MyItemsListView));

}
Now the question is how to access the following binding there in CommentsCell Class ?
mainLayout.SetBinding(VisualElement.BackgroundColorProperty, new Binding(".", BindingMode.Default, new isFirstOrLastColorConverter(),
MyItemsListView));


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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