listbox horizontal alignment wrap

978 Views Asked by At

how can I start items on a new row in a listbox which is orientated horizontally? this is my code so far, but it shows al the items in 1 row, thanx in advance

<phone:PanoramaItem Header="Geklassifiseerd" Orientation="Horizontal" Foreground="Black">
            <ListBox x:Name="geklassifisseerd_list">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" 
                                           Margin="10,0" 
                                           Foreground="Black"
                                           FontSize="20"
                                           />
                            <TextBlock Text="{Binding Date}" 
                                           TextWrapping="Wrap" 
                                           Foreground="Black"
                                           Margin="10,-2,10,0" 
                                           FontSize="20"
                                           />
                            <TextBlock Text="{Binding Image_uri}" 
                                           TextWrapping="Wrap" 
                                           Margin="10,-2,10,0" 
                                           Foreground="Black"
                                          />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>

                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>

            </ListBox>
1

There are 1 best solutions below

0
On

got the answer, I used a wrappanel in the itemspanetemplate, which led to assemblies clashing, which I solved by reinstalling the Microsoft.phhone.controls assembly via nugget

               <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Controls:WrapPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>