Answer the question
In order to leave comments, you need to log in
How to dynamically create Grid items?
I have a collection of data and a ListBox associated with it.
<Grid Grid.Column="1">
<ListBox ItemsSource="{Binding Notes}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Background="#FF81E072">
<TextBlock Text="{Binding Title}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
Answer the question
In order to leave comments, you need to log in
Can be set as a panel UniformGrid , then all rows will have the same height.
<ListBox Grid.Column="1" ItemsSource="{Binding Notes}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question