In WPF, I have time trying to set up the grid correctly.
I have the following layout for my grid:
<ItemsControl HorizontalContentAlignment="Stretch"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="80"/> <ColumnDefinition Width="80"/> <ColumnDefinition Width="100"/> </Grid.ColumnDefinitions> <Label Grid.Column="0" /> <Label Grid.Column="1"/> <TextBox Grid.Column="2"/> <Button Grid.Column="3"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>
The problem is that Width = "Auto" apparently determines the size of the column in the width of the content and does not fill the extra space in the parent container. This leaves the rest of the columns with jagged and ugly spaces at the end of each row.
I probably missed something simple, but I cannot find a method suitable for the corresponding column.
Or is there better control over work?
wpf grid
Justin Mathieu Sep 14 '12 at 21:24 2012-09-14 21:24
source share