WPF 实现DataGrid行鼠标经过、点击时的背景、文字、行高等样式

 

大家都懂不多解释,直接上代码
 
  <DataGrid.RowStyle >
  <Style TargetType= " DataGridRow ">
  <Style.Triggers>
  <Trigger Property= " IsMouseOver " Value= " True ">
  <Setter Property= " Background " Value= " #FFF1FAFF "/>
  <Setter Property= " FontSize " Value= "  20 "/>
  <Setter Property= " Height " Value= " 30 "/>
  <Setter Property= " Foreground " Value= " Blue "/>
  </Trigger>
  </Style.Triggers>
  </Style>
  </DataGrid.RowStyle>
  <DataGrid.CellStyle >
  <Style TargetType= " DataGridCell ">
  <Style.Triggers >
  <Trigger Property= " IsSelected " Value= " True ">
  <Setter Property= " Background " Value= " #FFF1FAFF "/>
  <Setter Property= " FontSize " Value= "  20 "/>
  <Setter Property= " Height " Value= " 30 "/>
  <Setter Property= " Foreground " Value= " Blue "/>
  </Trigger>
  </Style.Triggers>
  </Style>
  </DataGrid.CellStyle>

 

你可能感兴趣的:(datagrid)