Definine one grid to hold all the items of a ListBox in stead of a grid for each using a DataTemplate?

You can still accomplish this using the Grid inside of your DataTemplate. You would just need to specify the IsSharedSizeScope attached property on your ListBox and SharedSizeGroup property on the ColumnDefinitions you want to synchronize Alternatively you can define the ListBoxes' panel as a Grid, but I don't recommend that unless your Person objects have an ordering property which can be used easily to bind to Grid.Row.

You can still accomplish this using the Grid inside of your DataTemplate. You would just need to specify the IsSharedSizeScope attached property on your ListBox and SharedSizeGroup property on the ColumnDefinitions you want to synchronize. Alternatively you can define the ListBoxes' panel as a Grid, but I don't recommend that unless your Person objects have an ordering property which can be used easily to bind to Grid.Row.

I have a ListBox that is bound to a list of Persons. I want to show the items of the listbox in a grid. I can accomplish this with the code below, but the problem is that with this code each item has its own grid.

I want one grid to contain all items so that each column in the grid is automatically scaled to the width of the longest string. I suppose I should bind data to a Grid in stead?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions