Ticket T251108
Visible to All Users

Binding gridcolumn with converter to EntityInstantFeedbackDataSource

created 10 years ago

I have a GridControl bound to an EntityInstantFeedbackDataSource.
All columns make use of the FieldName property to bind:

<dxg:GridColumn FieldName="ContractNumber" >

How do I bind when using a custom converter? I've tried this to bind a property with fieldname 'Type'

<dxg:GridColumn  DisplayMemberBinding="{Binding Data.Type, Converter={StaticResource CustomConverter},ConverterParameter=Prm}">

But i get following error:

"System.Windows.Data Error: 40 : BindingExpression path error: 'Type' property not found on 'object' ''RowTypeDescriptor'. BindingExpression:Path=Data.Type; DataItem='EditGridCellData'"

Any ideas?

Thanks in advance

Comments (2)
DevExpress Support Team 10 years ago

    Hi Peter,

    It's strange that this property cannot be found. I have tested this approach on my side, and my binding works great - see the attached sample. Please check if Type is a public property - perhaps, you have marked it private, or this is a field, but not a property.
    I am looking forward to your results.

      Hi
      Indeed, your example works as it should work.
      But I provide the EntityInstantFeedbackDataSource via code-behind.
          <dxg:GridControl x:Name="grid"  ItemsSource="{Binding EntityInstantFeedbackDataSource.Data}">

      Code:
                     EntityInstantFeedbackDataSource = new EntityInstantFeedbackDataSource()
                     {
                         KeyExpression = "ID",
                         AreSourceRowsThreadSafe = false,
                         DataContext = context.Issues,
                         DesignData = DesignData,
                     };
                     grid.ItemsSource = EntityInstantFeedbackDataSource.Data;
      And then I still get the error:
                    BindingExpression path error: 'Subject' property not found on 'object' ''RowTypeDescriptor'
      It works for rows which use the FieldName property.
      I've attached your modified example.
      I something wrong with bindings?
      Thank you

      Answers approved by DevExpress Support

      created 10 years ago (modified 10 years ago)

      Hi Peter,
      As I can see, when you create the EntityInstantFeedbackDataSource, you set its DataContext and KeyExpression properties. To make this work, set EntityInstantFeedbackDataSource’s QueryableSource instead of DataContext or set its ContextType and Path properties in the following manner:

      C#
      EntityInstantFeedbackDataSource = new EntityInstantFeedbackDataSource() { ContextType=typeof(IssueContext), KeyExpression = "ID", Path="Issues", AreSourceRowsThreadSafe = false, DesignData = DesignData, }; grid.ItemsSource = EntityInstantFeedbackDataSource.Data;
      C#
      EntityInstantFeedbackDataSource = new EntityInstantFeedbackDataSource() { QueryableSource=context.Issues, KeyExpression = "ID", AreSourceRowsThreadSafe = false, DesignData = DesignData, }; grid.ItemsSource = EntityInstantFeedbackDataSource.Data;

      I have modified the sample project accordingly.
      Thanks,
      Nadya

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.