你好,我是新手使用Windows Phone 7,我在应用样式到窗口手机7中的列表框的交替行颜色时遇到了问题,请帮助我。
你好,我是新手使用Windows Phone 7,我在应用样式到窗口手机7中的列表框的交替行颜色时遇到了问题,请帮助我。
ALternationCount
属性,但Silverlight(包括Web版和WP7)不支持。在Silverlight中创建此效果的最简单方法是通过值转换器设置项目的背景颜色。请参阅以下线程: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;
}