0

I know that I can set the alternating row colour of list box by defining Item control style like this one

https://stackoverflow.com/a/3567894/1241992

I want to know how can I set this using Blend for Visual Studio. When I am designing my layout in Blend, I do not want to edit code and define my styles that way. I want to visualize and create my styles and I am sure there must be some way of doing it but I cannot figure out how. Strange thing is even if I try to edit this already defined style, I can not create another trigger property which defines AlternationIndex via Blend.

Community
  • 1
  • 1
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47

1 Answers1

0

Afraz,

You can do at least part of it using Blend.

  1. In Blend, select the ListBox, right click : Edit Additional templates/ Edit generated item container(itemContainerStyle)/ Edit a copy. It will create most of the code for the style of the ListBoxItem, that is a line of a ListBox.

  2. You can actually create some triggers going to the Trigger tab in the left of the screen. We want a property trigger But the triggers can only be created on properties of the ListBoxItem properties.
    Only properties of the ListBoxItem can be source of the triggers in the ComboBox just under. So rest of the code to affect the background color of the ListBoxItem has to be done in code.

Regards

Emmanuel DURIN
  • 4,803
  • 2
  • 28
  • 53
  • Thanks for your explanation, I was of the view that Blend was created keeping in view designers workflow and in my opinion setting the alternate BG color should really be a straight forward task. I am surprised that these triggers cannot be added via Blend interface. – Afraz Ali Oct 13 '15 at 02:35
  • Blend can help making many things (animations, styles, templates,...), but when it comes to a point you sometimes need to take the code to move it to another place because the wizards are not made to manage all the cases – Emmanuel DURIN Oct 13 '15 at 06:03