destro
Well-known member
- Joined
- Mar 28, 2020
- Messages
- 46
- Programming Experience
- 1-3
I have an observablecollection of class type as follows:
I am binding the Level and Planet selected with the ItemTemplate as follows:
Each objects comes in a new row but I want them to appear in new columns but keep only two rows.
I tried setting Grid.Row = 0 and Grid.Row = 1 for both labels but they still appear in new rows.
How do I represent the objects property in columns instead of rows?
VIew model:
public ObservableCollection<selectedLevel> selectedLevels { get; set; }
selectedLevels = new ObservableCollection<selectedLevel>();
public class selectedLevel
{
public string Level
{
get;
set;
}
public string PlanetSelected
{
get; set;
}
}
I am binding the Level and Planet selected with the ItemTemplate as follows:
Xaml:
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="Col1" />
<ColumnDefinition SharedSizeGroup="Col2" />
<ColumnDefinition SharedSizeGroup="Col3" />
<ColumnDefinition SharedSizeGroup="Col4" />
<ColumnDefinition SharedSizeGroup="Col5" />
<ColumnDefinition SharedSizeGroup="Col6" />
<ColumnDefinition SharedSizeGroup="Col7" />
<ColumnDefinition SharedSizeGroup="Col8" />
<ColumnDefinition SharedSizeGroup="Col9" />
<ColumnDefinition SharedSizeGroup="Col10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="Row1"/>
<RowDefinition SharedSizeGroup="Row2"/>
</Grid.RowDefinitions>
<Label Grid.Column="0" Content="{Binding Level}"/>
<Label Grid.Column="1" Content="{Binding PlanetSelected}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
Each objects comes in a new row but I want them to appear in new columns but keep only two rows.
I tried setting Grid.Row = 0 and Grid.Row = 1 for both labels but they still appear in new rows.
How do I represent the objects property in columns instead of rows?