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 8748163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:28:40+00:00 2026-06-13T12:28:40+00:00

So I am just joining the WPF club after dabbling in Winforms for a

  • 0

So I am just joining the WPF club after dabbling in Winforms for a couple of years. I am definiately enjoing the databinding in WPF, but I am having trouble with the DataGrid.

I have a highly-customized data structure that stores results from a SQL query, which I would like to continue to use in WPF. I have seen examples of binding to lists of objects, but not for anything dynamic like a SQL query.

Is there some interface that I can make my data structure implement so the DataGrid can get the necessary information such as the row & column count, headers, and the data?

  • 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-13T12:28:41+00:00Added an answer on June 13, 2026 at 12:28 pm

    My goal was to bind to my custom structure similar to a DataTable, allowing the DataGrid to “discover” information about my structure.

    The short answer is to implement the following interfaces:

    IList
    IEnumerable
    ITypedList

    As well as inheriting from CustomTypeDescriptor (or implementing ICustomTypeDescriptor)

    This Question helped a lot in dealing with the CustomTypeDescriptor stuff which was the most challenging.

    My enumeration object was simple an object that stored a reference back to the main table so it could ask what the value was at a specific row and column.

    public AgilityTableRow(AgilityTableBase table, int rowIndex)
        {
            _table = table;
            _rowIndex = rowIndex;
        }
    
        public object this[int columnIndex]
        {
            get 
            {
                return _table[columnIndex, _rowIndex]; 
            }
        }
    
        public object this[string columnName]
        {
    
            get 
            {
                return _table[_table.GetFieldIndex(columnName), _rowIndex]; 
            }
        }
    

    Note: this class needs to implement ICustomTypeDescriptor and can simply forward the call to the table to get the properties:

    public PropertyDescriptorCollection GetProperties()
        {
            return _table.GetProperties();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems getting an accurate count of a column after joining others. When
Just checking my JS and I have an error, but I cannot see where.
Just a simple question, but can't get an answer on my own. In memory
Just ran into an issue with a has_many :through association and after/before-destroy callbacks not
I have a query that does some magical sort-group-joining that works just fine on
I have a trouble on Joining a IObjectSet<T> with a IEnumerable<int> , where T
so I'm trying to do a full join on MS Access 2003 but just
I'm not sure if this can be done. But I just wanted to check
I've recently started creating a WPF application, and am just hoping that someone can
I'm joining a couple of tables, and aggregating some of the columns via GROUP

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.