I use XamComboEditor in following way for databinding:
<ig:XamComboEditor AllowFiltering="True" AutoComplete="True" ItemsSource="{Binding People, Mode=TwoWay}"DisplayMemberPath="Person.FirstName" SelectedItem="{Binding MyClass.Person, Mode=TwoWay}" />
But I want to DisplayMemberPath display the person full name like
DisplayMemberPath="Person.FirstName +Person.LastName "
How to implement this request?
Hi,
I couldn't quite understand what the problem is. So at the beginning the SelectedTrade.Strategy is null so AndComboEditor does not show selected item. And then the SelectedTrade.Strategy gets updated and then comboEditor does not show the updated SelectedTrade.Strategy as selected object?
What might be the problem could be if the SelectedTrade.Strategy could not be found in the ItemsSource so the SelectedItem stays null.
It would be better if you provide simplified solution where the issue could be easily reproducible where we could tell you for sure what is going on.
Regards,
Hi Infragistics Team,
I have a similar situation where I am using a XamComboEditor and setting the ItemSource, SelectedItem and DisplayMemberPath as shown below:
<igEditors:XamComboEditor Grid.Row="6" Grid.Column="1" Name="cmbStrategy" Width="100" HorizontalAlignment="Left" Margin="2,2,2,2" VerticalAlignment="Center" DisplayMemberPath="ShortName" IsEditable="True" LimitToList="True" ItemsSource="{Binding Strategies}" SelectedItem="{Binding SelectedTrade.Strategy, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
It works as expected for most part, binding, displaying etc. The Issue is .... when the underlying object SelectedTrade is updated, it doesn't display the "ShortName" as I want it to be (understandably right as we have not specified that). Question is how to do it? I know the object (SelectedTrade.Strategy) is getting populated, because a TextBox next to it has binding as Text="{Binding SelectedTrade.Strategy.PortfolioPath}" and the value is displayed.
The XamComboEditor needs to show reference data (say around 200 rows). The ItemSource is an ObservableCollection and the SelectedItem is bound to one such object. When the SelectedItem is updated in ViewModel, how can I tell the control to display the SelectedItem's properties and not from the ItemSource?
Any help in this regard is highly appreciated.
Thanks
Hello benjaminswitzer,
I am just checking if you require any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
The DisplayMemberPath should contains only the property name. SO the XAML should be:
<ig:XamComboEditor AllowFiltering="True" AutoComplete="True" ItemsSource="{Binding Employee, Mode=TwoWay}"DisplayMemberPath="FullName" SelectedItem="{Binding MyClass.Person, Mode=TwoWay}" />
SelectedItem binding looks suspicious. It will work if the DataContext of the combo has property MyClass which has a property Person.
EDIT: the bahavior in point 5 is expected - the combo don't know which property to look for when trying to auto complete when the there is no valid DisplayMemberPath provided.
HTH,
Thanks. Try your suggestion:
1. Add FullName property to People.
2. Change xaml as below:
<ig:XamComboEditor AllowFiltering="True" AutoComplete="True" ItemsSource="{Binding Employee, Mode=TwoWay}"DisplayMemberPath="Person.FullName" SelectedItem="{Binding MyClass.Person, Mode=TwoWay}" />
Employees has property People(assoication by FK as EF generated).
3. Run the app, got error said:
The provided DisplayMemberPath, Person.FullName, doesn't exist on the underlying object Employees.
4. But the data do display in dropdown. I can use mosue select the item from dropdown.
5. But can't use keyboard to type with autocomplete function, will have large amount of error popup.
How to resolve this issue?