Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. <Window x:Class="WpfApplication11.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="MainWindow" Height="350" Width="525">
  5.  
  6. <Grid>
  7. <DataGrid Name="DataGrid1" ItemsSource="{Binding Path=Fibers}">
  8. <DataGrid.RowStyle>
  9. <Style TargetType="DataGridRow">
  10. <Setter Property="FontSize" Value="12"/>
  11. <Style.Triggers>
  12. <Trigger Property="IsMouseOver" Value="True">
  13. <Setter Property="Background" Value="Blue"/>
  14. <Setter Property="Foreground" Value="White"/>
  15. </Trigger>
  16. </Style.Triggers>
  17. </Style>
  18. </DataGrid.RowStyle>
  19.  
  20. <DataGrid.Columns>
  21. <DataGridTextColumn Header="FiberNo" />
  22. <DataGridTextColumn Header="Fiber" />
  23. <DataGridTextColumn Header="Connection" />
  24. </DataGrid.Columns>
  25. </DataGrid>
  26. </Grid>
  27. </Window>
  28.  
  29. <Window x:Class="WpfApplication11.MainWindow"
  30. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  31. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  32. Title="MainWindow" Height="350" Width="525">
  33.  
  34. <Window.Resources>
  35. <DataGrid x:Key="MyDataGridStyle">
  36. <DataGrid.RowStyle>
  37. <Style TargetType="DataGridRow">
  38. <Setter Property="FontSize" Value="12"/>
  39. <Style.Triggers>
  40. <Trigger Property="IsMouseOver" Value="True">
  41. <Setter Property="Background" Value="Blue"/>
  42. <Setter Property="Foreground" Value="White"/>
  43. </Trigger>
  44. </Style.Triggers>
  45. </Style>
  46. </DataGrid.RowStyle>
  47. </DataGrid>
  48. </Window.Resources>
  49.  
  50. <Grid>
  51. <DataGrid Name="DataGrid1" ItemsSource="{Binding Path=Fibers}">
  52. <StaticResource ResourceKey="MyDataGridStyle"/>
  53.  
  54. <DataGrid.Columns>
  55. <DataGridTextColumn Header="FiberNo" />
  56. <DataGridTextColumn Header="Fiber" />
  57. <DataGridTextColumn Header="Connection" />
  58. </DataGrid.Columns>
  59. </DataGrid>
  60. </Grid>
  61. </Window>
  62.  
  63. <Window.Resources>
  64. <Style x:Key="MyDataGridStyle" TargetType="DataGridRow">
  65. <Setter Property="FontSize" Value="12"/>
  66. <Style.Triggers>
  67. <Trigger Property="IsMouseOver" Value="True">
  68. <Setter Property="Background" Value="Blue"/>
  69. <Setter Property="Foreground" Value="White"/>
  70. </Trigger>
  71. </Style.Triggers>
  72. </Style>
  73. </Window.Resources>
  74.  
  75. <DataGrid Name="DataGrid1"
  76. ItemsSource="{Binding Path=Fibers}"
  77. RowStyle="{StaticResource MyDataGridStyle}" ...>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement