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
45
How to pass in parameter to ValueToDisplayTextConverter?
posted

I need to pass in an extra parameter (DataItem) into my ValueToDisplayTextConverter so each cell can display its value AND unit when not editing, but just value when editing.  (Example - show "90%" when not editing, but "90" when editing)  So the current value of the cell IS 90, so editing appears correctly.  The unit (which could be different for every record) is another field on that record.

 

 <igDP:UnboundField Name="ValueAndUnit" Label="Value">
    <igDP:Field.Settings>
        <igDP:FieldSettings CellMinWidth="80" CellWidth="80" EditorType="{x:Type igEditors:XamNumericEditor}">
            <igDP:FieldSettings.EditorStyle>
                <Style TargetType="{x:Type igEditors:XamNumericEditor}" >
                    <Setter Property="ValueToDisplayTextConverter" Value="{StaticResource ParamValueConverter}"></Setter>
                    <Setter Property="PromptChar" Value=""></Setter>
                    <Setter Property="Mask" Value="{}{double:5.2}"></Setter>
                </Style>
            </igDP:FieldSettings.EditorStyle>
        </igDP:FieldSettings>
    </igDP:Field.Settings>
</igDP:UnboundField>
<igDP:Field Name="UnitOfMeasure" Visibility="Collapsed" />

 

If anybody could help, or point me towards something that would help I would appreciate it

Thanks 

Parents
  • 54937
    Verified Answer
    Offline posted

    There is no property to control the parameter but the parameter is always the ValueEditor itself (the XamNumericEditor in this case) so you can get its Host which in this case should be the CellValuePresenter. From that you can get to its Record property and from there to its Cells collection to get to the value of the other cell. Or you can look at the DataContext of the valueeditor which again in this case should be the DataRecord and then get to the Cells collection.

Reply Children
No Data