I have a grid bound to a data source and I wish to use a converter to change some of the values in the grid. I've used a converter before to change some of the other properties such as font color and they worked fine, but when it comes to changing content there's an issue.
I've debugged the code and the converter is getting correctly called and is return the correct values, but the raw values are still displayed in the grid. My converter is just returning strings, is there a reason why it's unable to render them?
Thanks
<DataPresenter:Field Name="myField" Width="Auto"> <DataPresenter:Field.Settings> <DataPresenter:FieldSettings> <DataPresenter:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type DataPresenter:CellValuePresenter}" > <Setter Property="" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content, Converter={StaticResource myConverter}}" /> </Style> </DataPresenter:FieldSettings.CellValuePresenterStyle> </DataPresenter:FieldSettings> </DataPresenter:Field.Settings> </DataPresenter:Field>
Once the record initialised method gets called, and i access the record using e_.Record, how can I access the cell I want?
(I have it's field name)
thanks
You have to cast the Record to DataRecord, because the DataRecord exposes the Cells collection :
(e.Record as DataRecord).Cells[...].Value. The cells collection has a int and string indexers, so you can access the specific field.