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

ListView - how do I change the text color ?

$
0
0

It seems to be permanently stuck on light blue. Ive tried the following :

public class ListPage : ContentPage
{

    private ITestViewModel _vm;
    public ListPage(ITestViewModel testvm, string Title)
    {

        _vm = testvm;

        this.Title = Title;

        BindingContext = testvm;

        var list = new ListView();

        list.ItemsSource = _vm.Models;
        list.BindingContext =  testvm;

        var cell = new DataTemplate(typeof(TextCell));
        cell.SetBinding( TextCell.TextProperty, "Text");
        cell.SetBinding(TextCell.TextColorProperty, "White");

        list.ItemTemplate = cell;
        list.ItemTapped += (sender, e) => { _vm.Executecommand.Execute(e.Item); };

        var stack = new StackLayout { Orientation = StackOrientation.Horizontal };
        stack.Children.Add(list);

        //var scv = new ScrollView { Content = stack, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = ScrollOrientation.Horizontal  };
        Content = stack;
    }


}

using datatemplate and then using TextCell.TextColorProperty to white, however this doesnt work. This should be a simple thing to do, but so far, Ive been able to affect the color in any way, including the use of themes etc...

Im missing something simple, but can't see it as yet


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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