1 pièce(s) jointe(s)
Le contenu d'un LongListSelector ne prend pas toute la place
Bonjour,
Je travaille actuellement sur une application Windows Phone 8 qui utilise le composant LongListSelector.
Pour peupler cette liste, j'ai créé un ItemTemplate dont le conteneur principal est une Grid et qui contient lui même des TextBlock. Pour une raison que j'ignore, ma Grid ne prend pas toute la place possible alors que ma LongListSelector oui.
Pour mieux illustrer mon problème, voici le code que j'utilise pour créer ma liste et son template, ainsi qu'une capture d'écran :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <phone:LongListSelector
HorizontalContentAlignment="Stretch"
HorizontalAlignment="Stretch"
ItemsSource="{Binding Data}"
Background="Aqua"
>
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<Grid
HorizontalAlignment="Stretch"
Background="Red"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25" />
<ColumnDefinition Width="75" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="47" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="45" />
<ColumnDefinition Width="35" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="1" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="2" Style="{StaticResource LineStyle}" Text="{Binding Value}" TextAlignment="Left" TextTrimming="WordEllipsis" />
<TextBlock Grid.Column="3" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="4" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="5" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="6" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
<TextBlock Grid.Column="7" Style="{StaticResource LineStyle}" Text="{Binding Value}" />
</Grid>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector> |
Le style des TextBlock :
Code:
1 2 3 4 5 6 7 8
|
<Style x:Key="LineStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Margin" Value="0, 12" />
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style> |
Une capture d'écran :
Pièce jointe 189319
Comment forcer ma Grid à prendre toute la place ?
Merci d'avance pour votre aide !