Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Datagrid: Converter in TemplateField and CellValuePresenter Template
posted

Hello,

I've got a problem with the converter(s) in XamDataGrid.

It's a "error reporting system"-grid where i have to write an ID and a translated text in each cell.

Code:

  <igWPF:TemplateField Name="Device"
                                         Converter="{StaticResource idToErrorConverter}"
                                         ConverterParameter="device"
                                         Label="{local:TranslateBinding 1206, FallbackValue=Bereich}">
                        <igWPF:TemplateField.CellValuePresenterStyle>
                            <Style TargetType="{x:Type igWPF:CellValuePresenter}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>                                    
                                                <Grid >
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*" />
                                                        <ColumnDefinition Width="auto" />
                                                    </Grid.ColumnDefinitions>
                                                    <TextBlock
                                                               Text="{Binding Path=DataItem.Device, Converter={StaticResource idToErrorConverter},       ConverterParameter=device}"/>
                                                    <TextBlock  Text="{Binding Path=DataItem.Device}" />
                                                </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </igWPF:TemplateField.CellValuePresenterStyle>
                    </igWPF:TemplateField>
                           
                       
                   

Problem:

If there is the converter set in TemplateField and in CellValuePresenter Template - on update for each cell is the converter called twice -> not optimal for performance.

If i only set the converter in CellValuePresenter the id of the cell is not translated to text by grouping or filtering.

If i only set the converter in TemplatField the id in cell is not translated.