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

  • Home
  • SEARCH
  • 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 8026277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:26:17+00:00 2026-06-04T23:26:17+00:00

I have my DataGrid and I have all results inside DataTable. DataTable dt =

  • 0

I have my DataGrid and I have all results inside DataTable.

DataTable dt = MakeTable();

<DataGrid Height="70" HorizontalAlignment="Left" Margin="3,1,0,0" Name="resultDataGrid" VerticalAlignment="Top" Width="475" ReadOnly="True">

I remember in Windows Form I was able to do something like:

dt.ItemSource = dt;

and it was working fine, but in WPF I am getting error: Cannot convert datasource DataTable to target IEnumerable.

Column names is always DIFFERENT, I cannot build a table manually!

How would I set it up?

  • 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-04T23:26:19+00:00Added an answer on June 4, 2026 at 11:26 pm

    Datatable don’t support ienumrable. so you need to cast your datatable into eighter ilist or enumrable source.

    try this.

    DataTable dt = new DataTable();
    resultDataGrid.ItemsSource =  dt.DefaultView
    

    also set AutoGenerateColumns=true if you are not setting column in advance.

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

Sidebar

Related Questions

I have a Silverlight app with a DataGrid containing some custom columns and all
I have a datagrid all set up, connected to an XMLStore. When the user
I have a datagrid(asp.net) on my page. I would like to select all rows
I have a datagrid: <mx:DataGrid id=resultsDataGrid height=328 width=604 paddingRight=0 editable=false y=43 horizontalCenter=0> <mx:columns> <mx:DataGridColumn
I have datagrid in wpf. When I do mouse-over on column header, There is
I have a datagrid with a list of JobItem objects, and when I select
I have a DataGrid that binding an ObservableCollection of self tracking entities Users can
I have a DataGrid with a bunch of rows representing items in my system.
I have a datagrid bound to an ObservableCollection<MyClass> , and I have another datagrid
I have a datagrid control in my project which has a combobox control manually

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.