Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is my (lame) version that adds a black background on the selected row and grey background on the current row. I had to overwrite the styles because I was painting the cells individually and the row selected was hidden.</p> <p>Just add the pasted code to you DataGrid instance:</p> <pre><code> &lt;local:DataGrid.RowStyle&gt; &lt;Style TargetType="local:DataGridRow"&gt; &lt;Setter Property="IsTabStop" Value="False" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="local:DataGridRow"&gt; &lt;localprimitives:DataGridFrozenGrid Name="Root"&gt; &lt;vsm:VisualStateManager.VisualStateGroups&gt; &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt; &lt;vsm:VisualStateGroup.Transitions&gt; &lt;vsm:VisualTransition GeneratedDuration="0" /&gt; &lt;/vsm:VisualStateGroup.Transitions&gt; &lt;vsm:VisualState x:Name="Normal" /&gt; &lt;vsm:VisualState x:Name="Normal AlternatingRow"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/&gt; &lt;/Storyboard&gt; &lt;/vsm:VisualState&gt; &lt;vsm:VisualState x:Name="MouseOver"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To=".5"/&gt; &lt;/Storyboard&gt; &lt;/vsm:VisualState&gt; &lt;vsm:VisualState x:Name="Normal Selected"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="BackgroundRectangleSelected" Storyboard.TargetProperty="Opacity" Duration="0" To="1" /&gt; &lt;/Storyboard&gt; &lt;/vsm:VisualState&gt; &lt;vsm:VisualState x:Name="MouseOver Selected"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="BackgroundRectangleSelected" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/&gt; &lt;/Storyboard&gt; &lt;/vsm:VisualState&gt; &lt;vsm:VisualState x:Name="Unfocused Selected"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="BackgroundRectangleSelected" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/&gt; &lt;ColorAnimationUsingKeyFrames BeginTime="0" Duration="0" Storyboard.TargetName="BackgroundRectangleSelected" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"&gt; &lt;SplineColorKeyFrame KeyTime="0" Value="Black"/&gt; &lt;/ColorAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/vsm:VisualState&gt; &lt;/vsm:VisualStateGroup&gt; &lt;/vsm:VisualStateManager.VisualStateGroups&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*"/&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.Resources&gt; &lt;Storyboard x:Key="DetailsVisibleTransition"&gt; &lt;DoubleAnimation Storyboard.TargetName="DetailsPresenter" Storyboard.TargetProperty="ContentHeight" Duration="00:00:0.1" /&gt; &lt;/Storyboard&gt; &lt;/Grid.Resources&gt; &lt;Rectangle x:Name="BackgroundRectangle" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0" Fill="#FFBADDE9"/&gt; &lt;Rectangle x:Name="BackgroundRectangleSelected" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0" Fill="Black"/&gt; &lt;localprimitives:DataGridRowHeader Grid.RowSpan="3" Name="RowHeader" localprimitives:DataGridFrozenGrid.IsFrozen="True" /&gt; &lt;localprimitives:DataGridCellsPresenter Margin="2" Grid.Column="1" Name="CellsPresenter" localprimitives:DataGridFrozenGrid.IsFrozen="True" /&gt; &lt;localprimitives:DataGridDetailsPresenter Grid.Row="1" Grid.Column="1" Name="DetailsPresenter" /&gt; &lt;Rectangle Grid.Row="2" Grid.Column="1" Name="BottomGridLine" HorizontalAlignment="Stretch" Height="1" /&gt; &lt;/localprimitives:DataGridFrozenGrid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/local:DataGrid.RowStyle&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload