wpf-datagrid/listbox隔行换色
2021-03-05 10:29
标签:trigger resource dex listbox bsp alter red box property listbox Datagrid wpf-datagrid/listbox隔行换色 标签:trigger resource dex listbox bsp alter red box property 原文地址:https://www.cnblogs.com/dangnianxiaoqingxin/p/12901827.html ListBox AlternationCount="2" >
ListBox.Resources>
Style TargetType="ListBoxItem">
Style.Triggers>
Trigger Property="ItemsControl.AlternationIndex" Value="0">
Setter Property="Background" Value="Red"/>
Trigger>
Trigger Property="ItemsControl.AlternationIndex" Value="1">
Setter Property="Background" Value="Black"/>
Trigger>
Style.Triggers>
Style>
ListBox.Resources>
ListBoxItem>1ListBoxItem>
ListBoxItem>2ListBoxItem>
ListBoxItem>3ListBoxItem>
ListBoxItem>4ListBoxItem>
ListBoxItem>5ListBoxItem>
ListBox>
DataGrid AlternationCount="2">
DataGrid.RowStyle>
Style TargetType="{x:Type DataGridRow}">
Style.Triggers>
Trigger Property="ItemsControl.AlternationIndex"
Value="0">
Setter Property="Background" Value="#FFE4DDB3" />
Trigger>
Trigger Property="ItemsControl.AlternationIndex"
Value="1">
Setter Property="Background" Value="#FFF2F2F2" />
Trigger>
Style.Triggers>
Style>
DataGrid.RowStyle>
DataGrid>
文章标题:wpf-datagrid/listbox隔行换色
文章链接:http://soscw.com/index.php/essay/60412.html