Ciao a tutti ho un problema con un datagrid e il colore delle sue righe.

Le righe sono raggruppate in base al "Tipo":

codice:
_portateView.GroupDescriptions.Add(new PropertyGroupDescription("Tipo"));
Nel datagrid imposto lo style del gruppo:

codice:
<DataGrid.GroupStyle> 
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}"> 
<GroupStyle.Panel> 
<ItemsPanelTemplate>
 <DataGridRowsPresenter />
 </ItemsPanelTemplate> 
</GroupStyle.Panel> 
</GroupStyle> 
</DataGrid.GroupStyle>
Infine nel tema dell'applicazione:

codice:
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}"> 
<Setter Property="Template"> 
<Setter.Value> 
<ControlTemplate TargetType="{x:Type GroupItem}">
 <Expander x:Name="exp" IsExpanded="True" Background="White" Foreground="Black"> <Expander.Header>
 <TextBlock Text="{Binding Name}" FontWeight="Bold"/> 
</Expander.Header> 
<ItemsPresenter /> 
</Expander> 
</ControlTemplate> 
</Setter.Value>
 </Setter>
 </Style>
Fin qui tutto ok, le righe vengono raggruppate.

Adesso vorrei colorare le righe in base ad alcuni valori. In altre griglie senza gruppi uso questo codice per colorare:

codice:
<DataGrid>
<DataGrid.Resources> 
<Style TargetType="DataGridRow"> 
<Setter Property="Background"> 
<Setter.Value> 
<MultiBinding Converter="{StaticResource QtaConverter}">
 <MultiBinding.Bindings> <Binding Path="campo1" Mode="TwoWay"></Binding> 
<Binding Path="campo2" Mode="TwoWay"></Binding> 
</MultiBinding.Bindings> 
</MultiBinding> 
</Setter.Value>
 </Setter>
 </Style> 
</DataGrid.Resources>

...

</Datagrid>
Dove QtaConverter è il mio converter. Il problema è che non riesco a colorare le righe, anche se il converter mi ritorna il colore giusto la riga rimane bianca.

Se invece setto lo style delle righe diretto :
codice:
<DataGrid>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow"> 
<Setter Property="Background" value="Red">
</DataGrid.RowStyle>

...
</DataGrid>
le righe vengono colorate.