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
60
Using XamDataGrid How can I combine 2 fields, Value, and Units to display in one cell
posted

Using a XamDataGrid I need to combine 2 fields into one to show the units.

My data has a field for Units and a field for Value as in the table.

Component Value Units
1 Cu Oxide 50.0 g
2 DI Water 100.0 ml
3 H2SO4 500.0 ml

I would like to combine the Value and Units fields using a IValueConverter or some other method so it looks like this table but cannot figure out how to make it work.

Component Value
1 Cu Oxide 50.0 g
2 DI Water 100.0 ml
3 H2SO4 500.0 ml

These tables are a simplified version of the actual grid view I am working with.

        <igDP:XamDataGrid Name="grid_Dose_Log" HorizontalAlignment="Left" Width="1090" Height="680" Canvas.Left="10" Canvas.Top="58" CellActivating="OnCellActivation">
            <igDP:XamDataGrid.FieldLayoutSettings>
                <igDP:FieldLayoutSettings RecordSelectorLocation="None"  AllowAddNew="False" AllowDelete="False" AutoFitMode="Always"   HighlightAlternateRecords="True" AllowFieldMoving="No"/>
            </igDP:XamDataGrid.FieldLayoutSettings>
            <igDP:XamDataGrid.FieldLayouts>
                <igDP:FieldLayout>
                    <igDP:Field Name="Date"   Width="150">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields" >
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamDateTimeEditor}">
                                        <Setter Property="Mask" Value ="mm/dd/yyyy hh:mm"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                        <Setter Property="AllowDropDown" Value="False" />
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Bath"   Width="80">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamNumericEditor}">
                                        <Setter Property="Mask" Value ="{}{double:1.0}"/>
                                        <Setter Property="PromptChar"  Value=""/>
                                        <Setter Property="SelectAllBehavior" Value="SelectEnteredCharacters" />
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                        <Setter Property="Value" Value="0"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Tank"  Width="120">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields"  >
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamTextEditor}">
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                        <Setter Property="IsReadOnly"   Value="True" />
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Constituent"  Width="200">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields"  >
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamTextEditor}">
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                        <Setter Property="IsReadOnly"   Value="True" />
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Requested" Width="100" Label="Requested (ml)">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamNumericEditor}">
                                        <Setter Property="Mask" Value ="{}{double:8.1}"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Totalized"   Width="100" Label="Totalized (ml)">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamNumericEditor}">
                                        <Setter Property="Mask" Value ="{}{double:8.1}"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Time" Width="100" Label="Time (sec)">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamNumericEditor}">
                                        <Setter Property="Mask" Value ="{}{double:8.1}"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Rate" Width="100" Label="Rate (ml/min)">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamNumericEditor}">
                                        <Setter Property="Mask" Value ="{}{double:8.1}"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>

                    <igDP:Field Name="Auto"  Width="60">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamCheckEditor}">
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <igDP:Field Name="Error"  Width="60">
                        <igDP:Field.Settings>
                            <igDP:FieldSettings LabelTextAlignment="Center" LabelClickAction="SortByMultipleFields">
                                <igDP:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type igEditors:XamCheckEditor}">
                                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    </Style>
                                </igDP:FieldSettings.EditorStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    
                </igDP:FieldLayout>
            </igDP:XamDataGrid.FieldLayouts>
        </igDP:XamDataGrid>