Data Binding [Combobox in Gridview]

How to bind data to combobox inside gridview using wpf

Page 1 of 1

1 Replies - 10131 Views - Last Post: 30 March 2010 - 11:26 AM Rate Topic: -----

#1 nnbujji  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-January 10

Data Binding [Combobox in Gridview]

Post icon  Posted 06 January 2010 - 02:45 AM

I want bind tha data from sqlserver to combobox inside gridview using wpf.
Is This A Good Question/Topic? 0
  • +

Replies To: Data Binding [Combobox in Gridview]

#2 voltje  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 30-March 10

Re: Data Binding [Combobox in Gridview]

Posted 30 March 2010 - 11:26 AM

Hello.
If u want to get some help try to specify your questions.
Im late at answering, you probably won't even read this anymore.

But for those we will ever have the same question i'll make a short answer.

You do not bind the Combobox to the SqlServer itselve...

I suppose u know how to read from your database ?

Well you fill a list with the data from your database.

So for examle u now got a List filled With Car Objects...

The Car object has properties named: Brand and Model.
Don't forget to override the ToString methode and u can return for example Brand + " " + Model;

So now u got the list.

All u need to do is eather in Xaml or eather in C#.
I'll explain in C#:

You just do Combobox.ItemsSource = yourList

now it will display the ToString Method inside the combobox.
If you for example only want to display the Brand u can do:

Combobox.DisplayMemberPath = "Brand";
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1