wpf style converter : "Convert" called by every datagrid column using it
- by Sonic Soul
I created a converter, and assigned it to a style.
than i assigned that style, to the columns i want affected.
as rows are added, and while stepping through debugger, i noticed that the converter convert method gets called 1 time per column (each time it is used).
is there a way to optimize it better, so that it gets called only once and all columns using it get the same value?
<Style x:Key="ConditionalColorStyle" TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource CellStyle}">
<Setter Property="Foreground">
<Setter.Value>
<Binding>
<Binding.Converter>
<local:ConditionalColorConverter />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>