Hello, I'm trying to display a combobox column on my grid with data based on a List<UnitOfMeasure> that is a member of the row being displayed. I.e. ItemNumber, ItemDescription, ItemUOMs. The grid wants to display the ItemUOMs as a hierarchy. I just want the content displayed in a combobox.
Help.
<igDP:Field Name="ItemUOMs"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsSource" Value="{Binding ItemUOMs}" /> <Setter Property="DisplayMemberPath" Value="UOM" /> <Setter Property="ValuePath" Value="UOM" /> <Setter Property="Value" Value="UOM" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings></igDP:Field>
Hello,
Thank you for your post. I have been looking through it and the code you have provided and I suggest you set the FieldLayoutSettings’ AutoGenerateFields Property to False, if you haven’t, and define your Fields. Also instead of Field for the “ItemsUOMs” you can use UnboundField and set its BindingPath Property to ItemsUOMs and the Binding’s Path for the XamComboEditor’s ItemsSource should be DataItem.ItemsUOMs. Please let me know if this helps you or you need further clarifications on this matter.
Looking forward for your reply.
This is what I ended up doing, which I think is pretty much in line with your suggestion:
<igDP:Field Name="UOM"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsSource" Value="{Binding DataItem.EndItemUOMs}" /> <Setter Property="SelectedItem" Value="{Binding DataItem.UOM}" /> <Setter Property="DisplayMemberPath" Value="UOM" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings></igDP:Field>
EndItemUOMs is a list of valid units of measure for the current row, hence it is the ItemsSource. UOM is the currently selected UOM, hence it is the SelectedItem. UOM is the string value I want displayed (i.e. LB, KG, EACH). It seems to work great.
Thanks.
Hello again,
Thank you for your feedback. I am happy to hear that you have resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.