Hi I am New to Window phone 7, I have a Problem for Applying style to alternate row color in listbox in Window phone 7. Please Help Me.
While WPF has an ALternationCount
property that supports this, Silverlight, both the web version and WP7, do not. The easiest way to create this effect in Silverlight is to set the bacground colour of your item via a value converter. See the following thread:
Alternating background colors for ListBox rows
private void Item_LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
StackPanel ItemRef = sender as StackPanel; // get the reference to the control
SolidColorBrush brush1 = new SolidColorBrush(Color.FromArgb(0,0,0,0)); //base colour
SolidColorBrush brush2 = new SolidColorBrush(Color.FromArgb(255,255,0,0)); //alternate colour
if (_useAlternate)
ItemRef.Background = brush1;
else
ItemRef.Background = brush2;
_useAlternate = !_useAlternate;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With