Create a new row at the bottom of DataGrid (When User Click on Button(Out side of DataGrid))
-
Hi All, I have to take the inputs as multiple entries in WPF data grid like this. ---------------------------------------------------------------------------------------------------------------------- | Select Option | Name | Age |Country | Action | Action | ---------------------------------------------------------------------------------------------------------------------- | option button | textbox | textbox | combobox | linkbutton edit/update row | linkbutton edit row | ------------------------------------------------------------------------------------------------------------ ADD Button ----------------------------------------------- --> By clicking the ADD button i have to create a new row with new controls as in 2nd row. --> By clicking the DELETE button in the 5th cell the corresponding row should be deleted. --> By clicking the EDIT button in the 4th cell the corresponding row should be UPDATED(if user want) Can I achieve this by taking WPF Data grid (WPF tool Kit Latest Build ), and how? Or is there any other ways to achieve this? Suggest me some URLs, Samples..etc Many Many Thanks in Advance. Eswara G
-
Hi All, I have to take the inputs as multiple entries in WPF data grid like this. ---------------------------------------------------------------------------------------------------------------------- | Select Option | Name | Age |Country | Action | Action | ---------------------------------------------------------------------------------------------------------------------- | option button | textbox | textbox | combobox | linkbutton edit/update row | linkbutton edit row | ------------------------------------------------------------------------------------------------------------ ADD Button ----------------------------------------------- --> By clicking the ADD button i have to create a new row with new controls as in 2nd row. --> By clicking the DELETE button in the 5th cell the corresponding row should be deleted. --> By clicking the EDIT button in the 4th cell the corresponding row should be UPDATED(if user want) Can I achieve this by taking WPF Data grid (WPF tool Kit Latest Build ), and how? Or is there any other ways to achieve this? Suggest me some URLs, Samples..etc Many Many Thanks in Advance. Eswara G
If the itemssource for the datagrid is an observablecollection, generally all you need to do is add or remove items from the collection and the datagrid will update appropriately. How are you providing data to the datagrid?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
If the itemssource for the datagrid is an observablecollection, generally all you need to do is add or remove items from the collection and the datagrid will update appropriately. How are you providing data to the datagrid?
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi Mark Salsbery, Thanks for Quick Reply, Right now am providing data by using DataSet like dgXXX.ItemsSource= dataSetXX.Tables[0].DefaultView; Case 1: How to convert Data set to observablecollection.. case 2. i have some limitations, a) I am retrieving data as DataSet from Oracle11g by using Ref_cursor. Now ... Please suggest me a way to approach. Thanks Eswara G
-
Hi Mark Salsbery, Thanks for Quick Reply, Right now am providing data by using DataSet like dgXXX.ItemsSource= dataSetXX.Tables[0].DefaultView; Case 1: How to convert Data set to observablecollection.. case 2. i have some limitations, a) I am retrieving data as DataSet from Oracle11g by using Ref_cursor. Now ... Please suggest me a way to approach. Thanks Eswara G
You should be able to use the DataTable as-is if I remember right. dataSetXX.Tables[0].Rows is the collection you can add/delete items from (using DataTable.NewRow() to create new rows to insert). dgXXX.SelectedItem should give you the DataRow selected in the datagrid. Here's some more info: Windows Presentation Foundation Data Binding: Part 2[^]
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You should be able to use the DataTable as-is if I remember right. dataSetXX.Tables[0].Rows is the collection you can add/delete items from (using DataTable.NewRow() to create new rows to insert). dgXXX.SelectedItem should give you the DataRow selected in the datagrid. Here's some more info: Windows Presentation Foundation Data Binding: Part 2[^]
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Thank you Mark.. I tried this way..But am unable complete my requirement... Can you provide me some sample code or Application or URL.. Regards, Eswara G
Eswa wrote:
Can you provide me some sample code or Application or URL..
Here's one example (see first reply): Binding a WPF listview to a DataTable[^] An article with a little background in it: How do I bind to ADO.NET?[^] If you can show a simple example of what you tried that didn't work then maybe I can see what's going on...
Mark Salsbery Microsoft MVP - Visual C++ :java: