2011-09-07 18 views

risposta

32

è possibile associare il Background nella RowStyle per DataGrid

<DataGrid ...> 
    <DataGrid.RowStyle> 
     <Style TargetType="DataGridRow"> 
      <Setter Property="Background" Value="{Binding MyBackground}"/> 
     </Style> 
    </DataGrid.RowStyle> 
    <!-- ... --> 
</DataGrid> 

Ciò funzionerà se MyBackground è un Brush. È menzione nella sua domanda che avete una Color, se questo è il caso è possibile utilizzare questo invece

<Setter Property="Background"> 
    <Setter.Value> 
     <SolidColorBrush Color="{Binding MyColor}"/> 
    </Setter.Value> 
</Setter> 
+0

grazie Vado a controllare lo – david

Problemi correlati