Is it possible to write this out in a slicker/shorter way? all it is doing is setting 3 properties and taking too much room IMO..
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource BasicFont}">
<Setter Property="Foreground">
<Setter.Value>
<Binding>
<Binding.Converter>
<local:ForegroundColorConverter />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<Binding>
<Binding.Converter>
<local:ColorConverter />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>
<Binding>
<Binding.Converter>
<local:ColorConverter />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>
Sort of, first you have to define the Converters before the Style:
Then you can use them as StaticResources in your style:
Full example
C#:
XAML:
Btw, now that I think about it, not sure if you simplified your code, but you don’t actually need a converter for that. You can set a SolidColorBrush instead of a Converter (unless you’re doing some code in the converter), something like this: