I'm trying to change the color of a row on a ListView with JScript.Net. I'm scripting againts an application where I dont have access to the code, but I can add scripts that modify the ListView.
What I'm trying is this:
this.listView = controller.RenderEngine.ListControl.ListView;
this.listView.Items[0].UseItemStyleForSubItems = false;
this.listView.Items[0].SubItems[1].ForeColor = new System.Windows.Media.SolidColorBrush(Colors.Yellow);
or
this.rows = IList(listView.ItemsSource); // Use the ItemsSource to get data
rows[1].Forecolor = new System.Windows.Media.SolidColorBrush(Colors.Yellow);
this.listView.Items(0).FonttWeight = System.Windows.Controls.FontWeights.UltraBold;
Anything of this is working.
I can make it work however with instructions like:
listViewItem = listView.ItemContainerGenerator.ContainerFromIndex(i);
listViewItem.Background = color;
But with this solution if there is scroll or change of focus on the ListView the changes on the painted rows disapear.
Any ideas?.
Thanks for your time.