Try to use Add a template column in following way:
<ig:TemplateColumn Key="Organization" > <ig:TemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="MyColumn" /> </DataTemplate> </ig:TemplateColumn.HeaderTemplate> <ig:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock x:Name="DisplayName" Text="{Binding Organization.ID,Converter={StaticResource IDToNameConverter}}" /> </DataTemplate> </ig:TemplateColumn.ItemTemplate> <ig:TemplateColumn.EditorTemplate> <DataTemplate> <ig:XamComboEditor SelectedItem="{Binding Organization, Mode=TwoWay}" DisplayMemberPath="{Binding Organization.ID,Converter={StaticResource IDToNameConverter}}" Width="310"/> </DataTemplate> </ig:TemplateColumn.EditorTemplate></ig:TemplateColumn>
When user doulble click on cell to enter edit mode, got following error:
at MS.Internal.XcpImports.GetClassFullName(String coreClassName) at System.Windows.DependencyProperty.LookupAttachedCoreProperty(String propertyName) at System.Windows.PropertyPathParser.GetDpFromName(String name, Boolean namespaceMappingAvailable) at System.Windows.PropertyPathParser.ReadAttachedPropertyStepDescriptor(Boolean calledFromParser) at System.Windows.PropertyPathParser.ReadStepDescriptor(Boolean calledFromParser) at System.Windows.PropertyPathParser.Parse() at System.Windows.Data.Binding..ctor(String path) at Infragistics.Controls.Editors.XamComboEditor.ResolveText(Object dataItem) at Infragistics.Controls.Editors.XamComboEditor.InvalidateSelectedContent() at Infragistics.Controls.Editors.XamComboEditor.SelectedItems_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item) at System.Collections.ObjectModel.Collection`1.Add(T item) at Infragistics.Controls.Editors.XamComboEditor.SelectItem(Object data, Int32 index, Boolean clearRestOfSelection) at Infragistics.Controls.Editors.XamComboEditor.ApplyItemSource(IEnumerable itemSource) at Infragistics.Controls.Editors.XamComboEditor.XamWebComboEditor_Loaded(Object sender, RoutedEventArgs e) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
it is because of binding for DisplayMemberPath in XamComboEditor.
If remove converter, setDisplayMemberPath ="{Binding Name}", no error but only display object like Organization:1234 in dropdow.
If remove binding,set DisplayMemberPath="Name", it is fine.
So want to know if DisplayMemberPath support binding? how to fix it? I want to display more data for DisplayMemberPath, that's why I try converter.
Hello,
The reason for the exception that you are getting is that you are setting the DisplayMemberPath property to string that does not corresponds to any property of the objects that are used as a source of the XamComboEditor. When you are setting the DisplayMemberPath property a binding is created to the property of the data source that has the same name as the value of the DisplayMemberPath. If you are using a converter to return a string that does not match one of the properties of the underlying data, it is expected to get an error.
I can suggest setting the IsEditable property of the XamComboEditor to false and use the ItemTemplate property. In the ItemTemplate you can add a TextBlock for example and bind the Text property to the Id of your object and using your converter you can display the text that you are looking for.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
I have somewhat of a similar situation as the problem described in your post except that my combobox is not inside of a grid control. The regurla XamComboEditor does not have an ItemTemplate defined...but it does have a Template.
the following code did not work for me...when the converter is called the properties of the set datasource of the combobox are not properly being translated to the textbox...I know that i must use some kind of relative source to access this variables but I'm not sure what it's looking for....could you help?
<igEditors:XamComboEditor Grid.Column="1" Grid.Row="2" Name="cbFGPlayer" ItemsSource="{Binding PlayerCollection}" SelectedItem="{Binding FieldGoal.Player,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}" ValuePath="PlayerId" > <igEditors:XamComboEditor.Template> <ControlTemplate> <TextBlock> <TextBlock.Text> <MultiBinding Converter="{StaticResource PlayerDescConverter}"> <Binding Path="PlayerNumber"/> <Binding Path="LastName"/> <Binding Path="FirstName"/> <Binding Path="Position"/> </MultiBinding> </TextBlock.Text> </TextBlock> </ControlTemplate> </igEditors:XamComboEditor.Template> </igEditors:XamComboEditor>
When you bind SelectedItem, maybe should not use ValuePath, use DisplayMemberPath instead.
And put what for displaymemberpath? can you show me an example? basically what i need is to displayplaymember path to be formatted to show a few properties of my object player.
so like the display for the dropdowns should show S.AppendFormat(" {0} {1} {3} ", FirstName, Lastname, PlayerNumber")
i had tried using
<igEditors:XamComboEditor Grid.Column="1" Grid.Row="2" Name="cbFGPlayer" ItemsSource="{Binding PlayerCollection}"
SelectedItem="{Binding FieldGoal.Player,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}" ValuePath="PlayerId" >
SelectedItem="{Binding FieldGoal.Player,NotifyOnSourceUpdated=True,UpdateSourceTrigger=PropertyChanged}" >
<igEditors:XamComboEditor.Template>
<ControlTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat=" {0} - {1}, {2} ({3}) ">
<Binding Path="PlayerNumber"/>
<Binding Path="LastName"/>
<Binding Path="FirstName"/>
<Binding Path="Position"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</ControlTemplate>
</igEditors:XamComboEditor.Template>
</igEditors:XamComboEditor>
but that didn't work