1 pièce(s) jointe(s)
Wpf WrapPanel dans une listview sans scrollbar
Bonjour,
Je voudrai créer une liste via un wrappanel afin de gérer les sauts de lignes lorsde l'affichage.
Je fais ceci ;
Pièce jointe 191433
Hors mon WrapPanel ne s'agrandit qu'en largeur...
J'ai donc une barre de défilement horizontal qui me créer alors que je voudrais que celui-ci grandisse en hauteur.
Mon objectif est que la 2e Ligne de la grille (de départ) gagne en hauteur en fonction du listview qui lui devrai grandir en fonction du wrappanel.
Mais dans ce cas j'ai juste une scrollbar horizontal dans mon listview...
Mon code ressemble à ceci.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| <Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*">
</ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="0,5,0,5"
Style="{StaticResource TextBlockTitre}"
FontSize="14"
Text="ACCES AUX SERVICES" />
<ListView
Grid.Row="1"
Margin="5"
ItemsSource="{Binding Services}"
Height="auto"
>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel
Orientation="Horizontal"
HorizontalAlignment="Center"
/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="70"
Margin="5 0 5 0"
>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Text="{Binding Nom}"
HorizontalAlignment="Center"
VerticalAlignment="Center">
</TextBlock>
<CheckBox
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center">
</CheckBox>
</Grid>
<!--<Rectangle Stroke="Red" Margin="5"></Rectangle>-->
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid> |
Si vous avez une idée je suis preneur.