WPF Binding Query to GridView-VBForums
Results 1 to 7 of 7

Thread: WPF Binding Query to GridView

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    224

    Question WPF Binding Query to GridView

    Okay, I'm learning WPF and am working on my first program that actually pulls data from the database. I have a listview (gridview), and I have a query that I want to use to fill that control. The query joins two tables together to get the data I want.... it returns six columns from two tables.

    How do I bind the the results of that query so that the data shows up in the gridview?

    Dead easy in windows forms, but can't figure it out in WPF...

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: WPF Binding Query to GridView

    Use the WPF forum here. There are, however, a ton of articles on data-binding in WPF.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,652

    Re: WPF Binding Query to GridView

    This was the first result in a search for wpf bind listview:

    http://www.c-sharpcorner.com/uploadf...tabinding.aspx

    Took me about 10 seconds to find it.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,091

    Re: WPF Binding Query to GridView

    Thread moved from the 'VB.Net' forum to the 'WPF, WCF, WF' forum (thanks for letting us know jmcilhinney )

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    224

    Re: WPF Binding Query to GridView

    Yes, jmcilhinney, I found that, too. But my query joins two tables... is the syntax on the code side still the same? I mean, do I still:

    ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView;

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    87,652

    Re: WPF Binding Query to GridView

    Quote Originally Posted by HongKongCV View Post
    Yes, jmcilhinney, I found that, too. But my query joins two tables... is the syntax on the code side still the same? I mean, do I still:

    ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView;
    Did it work when you tried it? Wouldn't that answer your question?

    A DataTable is a DataTable. Where the data comes from is irrelevant once it's in the DataTable.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Posts
    224

    Re: WPF Binding Query to GridView

    Okay, I got it working... I have a related problem, but I'll post that in another thread.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.