A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
Hi,
set the element style to use ForeColor property from data item:
<DataGridTextColumn Header="FontSize"
Width="80"
Binding="{Binding FontSize}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{Binding ForeColor}" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
or use Proxy for ForeColor property from ViewModel (DataContext):
<FrameworkElement x:Name="ProxyElement" Visibility="Collapsed"/>
<DataGrid ItemsSource="{Binding View}" AutoGenerateColumns="False" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="FontSize"
Width="80"
Binding="{Binding FontSize}"
Foreground="{Binding DataContext.ForeColor, Source={x:Reference ProxyElement}}"/>