GridView displaying 2 columns with custom controls
-
I am new to WPF, so bear with him. I want to have a GridView with 2 columns, displaying custom controls, which has X amount of rows. The data i am given is in a list format, which i then need to display as follows: i want to insert item 1 in column 1 and item 2 in column 2 for row 1. And then item 3 in column 1 and item 4 in column 2 for row 2, and so on - (Think of it a bit like a photo gallery) The custom control will display the details for each item, which i have already created. The problem i have is, how do i bind the data to the GridView. My initial idea was to split the data into rows, i.e.: have several lists, that contain 2 items. This allows me to know that item 1 is for column 1 and item 2 is for column 2, i can then work my way through all the lists and end up with all the rows populated with the custom controls. However, i cant work out how to programmtically add a new row, which should have a control in each column. Am i going about it the right way? Or barking up the wrong tree... Hopefully i've made sense. Cheers.
Regards, Gareth. (FKA gareth111)
-
I am new to WPF, so bear with him. I want to have a GridView with 2 columns, displaying custom controls, which has X amount of rows. The data i am given is in a list format, which i then need to display as follows: i want to insert item 1 in column 1 and item 2 in column 2 for row 1. And then item 3 in column 1 and item 4 in column 2 for row 2, and so on - (Think of it a bit like a photo gallery) The custom control will display the details for each item, which i have already created. The problem i have is, how do i bind the data to the GridView. My initial idea was to split the data into rows, i.e.: have several lists, that contain 2 items. This allows me to know that item 1 is for column 1 and item 2 is for column 2, i can then work my way through all the lists and end up with all the rows populated with the custom controls. However, i cant work out how to programmtically add a new row, which should have a control in each column. Am i going about it the right way? Or barking up the wrong tree... Hopefully i've made sense. Cheers.
Regards, Gareth. (FKA gareth111)
-
I've changed my idea to have to have 2 stack panels, as this seems more fitting.
Regards, Gareth. (FKA gareth111)