XamComboEditor with concatenated displayMemberPath

Answered (Verified) This post has 1 verified answer | 3 Replies | 2 Followers Thread's RSS feed.

carlzuroski
Points 160
Replied On: Thu, Jan 31 2013 10:28 AM Reply

Hello,

I have the following code -

<igEditors:XamComboEditor ItemsSource="{Binding Instances}"
                                          Margin="5,2,5,2" Width="175" HorizontalAlignment="Left"
                                          SelectedItem="{Binding SelectedInstance,Mode=TwoWay,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnExceptions=True}"
                                          >
                    <igEditors:XamComboEditor.ComboBoxStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="ItemTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <TextBlock>
                                            <TextBlock.Text>
                                                <MultiBinding StringFormat="{}{0} ({1})">
                                                    <Binding Path="Name" />
                                                    <Binding Path="Id" />
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>                        
                    </igEditors:XamComboEditor.ComboBoxStyle>
                </igEditors:XamComboEditor>

When I set the SelectedInstance from my viewmodel, the combobox is displaying the type of the object.  If I then make a selection, it displays correctly, but I click out of the combobox, losing focus, it reverts back to the object type. If I set the DisplayMemberPath manually to just Name, it works correctly, but I really need it to be a concatenated value for the displaymemberpath.

Can anyone help?

Thanks

  • Post Points: 20

Verified Answer

[Infragistics]Stefan
Points 124,438
Infragistics Employee
Answered (Verified) Replied On: Fri, Feb 1 2013 5:54 AM Reply
Verified by carlzuroski

Hello,

 

Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I used the XamComboEditor’s ValueToDisplayConverter in order to convert the value that will display when not in edit mode. Please let me know if this helps you or you need further assistance on this matter.

 

Looking forward for your reply.

Sincerely,
Stefan, MCPD
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 40

All Replies

[Infragistics]Stefan
Points 124,438
Infragistics Employee
Answered (Verified) Replied On: Fri, Feb 1 2013 5:54 AM Reply
Verified by carlzuroski

Hello,

 

Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I used the XamComboEditor’s ValueToDisplayConverter in order to convert the value that will display when not in edit mode. Please let me know if this helps you or you need further assistance on this matter.

 

Looking forward for your reply.

Sincerely,
Stefan, MCPD
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 40
carlzuroski
Points 160
Replied On: Fri, Feb 1 2013 8:11 AM Reply

That solution worked perfectly - thanks for the help.

  • Post Points: 20
[Infragistics]Stefan
Points 124,438
Infragistics Employee
Replied On: Fri, Feb 1 2013 9:39 AM Reply

Hello,

 

Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.

 

Thanks again.

Sincerely,
Stefan, MCPD
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 5
Page 1 of 1 (4 items) | RSS