Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8598711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:13:10+00:00 2026-06-12T01:13:10+00:00

How can I specify object in DataGrid binding? My datagrid have ItemsSource={Binding Source=TripsCollection} and

  • 0

How can I specify object in DataGrid binding?
My datagrid have ItemsSource="{Binding Source=TripsCollection}" and AutoGenerateColumns="False", and Columns set as:

<DataGrid.Columns>
     <DataGridTextColumn Header="ID" Binding="{Binding TripID}" IsReadOnly="True"></DataGridTextColumn>
     ...
</DataGrid.Columns>

But have errors:

System.Windows.Data Error: 40 : BindingExpression path error: ‘TripID’
property not found on ‘object’ ”Char’ (HashCode=7209070)’.
BindingExpression:Path=TripID; DataItem=’Char’ (HashCode=7209070);
target element is ‘TextBlock’ (Name=”); target property is ‘Text’
(type ‘String’).

How can I set object to Trip object?

DataContext class:

private ObservableCollection<Trip> _tripsCollection;
    public ObservableCollection<Trip> TripsCollection
    {
        get { return _tripsCollection; }
        set { _tripsCollection = value; NotifyPropertyChanged("TripsCollection"); }
    }

Trip class:

[Table(Name="Trips")]
public class Trip
{
    private uint _tripID;
    private string _start;
    private string _end;
    private DateTime _date;
    private double _length;
    private string _note;
    private uint _carID = 0;
    private EntityRef<Car> _Car;

    ..and properties for this fields..
}

Setting up DataContext

public MainWindow()
{
    InitializeComponent();
    string connString = @"Data Source=.\SQLEXPRESS; Integrated security=SSPI; Connect Timeout=30"; // User Instance=True";
    conn = new SqlConnection(connString);
    conn.Open();

    LogBookViewModel lbvm = new LogBookViewModel(conn);
    DataContext = lbvm;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:13:11+00:00Added an answer on June 12, 2026 at 1:13 am

    You must change binding in ItemsSource, from this:

    ItemsSource="{Binding Source=TripsCollection}"
    

    to this:

    ItemsSource="{Binding TripsCollection}"
    

    If you will have problem with binding in the future try use snoop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application where for each object the user can specify his own
I have a DataGrid bound to a DataView which, among other columns has, an
Yeah, not sure I understand the difference. Because you can specify the target object
I can specify a port number with SmtpClient object in ASP.NET, what I am
I have a requirement whereby a user can specify a variable number of user-defined
Asking for recommendations. I want an object on which I can specify a port
Normally, one can specify a service binding using the app.config file, and the system
I have a WPF DataGrid control that is binding to a collection of objects.
How can I specify the Request object formatting in XML? My web services look
Then we create buffer object we can specify many colour attachments from 0 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.