Style TargetType=xType DataGrid Setter Property=AlternatingRowBackground Value=#D3D3D3 StyleTriggers Trigger Property=ItemsControlAlternationIndex
To use your specified DataGrid style instead of a global one, you can add the style to the DataGrid explicitly by setting the Style property to the name of the style in XAML. For example:
<DataGrid Style="{StaticResource YourDataGridStyle}" .../>
Make sure to replace "YourDataGridStyle" with the actual name of your style resource. This will override any global style for the DataGrid and apply your custom style.
原文地址: http://www.cveoy.top/t/topic/cRZr 著作权归作者所有。请勿转载和采集!