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
4970
Displaypath binding problem of XamComboEditor in XamGrid
posted

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.

 

 

 

 

Parents
  • 30945
    Offline posted

    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

    TemplateColumnWithCombo.zip
Reply Children