I have to ask for help, although I cannot figure it out myself. I am working on a WPF-XAML desktop application in which a GUI is dynamically generated.
My request is for styling a WrapPanel with ListBox elements.
Please find the code snippet from my usercontrol (.xaml):
<DockPanel x:Name="xResultPanel"> <ListView x:Name="bResultPanel" ItemsSource="{Binding ResultList, UpdateSourceTrigger=PropertyChanged}"> <ListView.ItemTemplate> <DataTemplate> <Expander Header="{Binding GroupName}" Style="{DynamicResource FeatureExpander2}"> <WrapPanel ItemWidth="140" Orientation="Horizontal"> <ListBox x:Name="ListOfTiles" ItemsSource="{Binding VideoSamples}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Width="120" Margin="10" HorizontalAlignment="Left"> <Image /> <TextBlock /> </StackPanel </DataTemplate> </ListBox.ItemTemplate> </ListBox> </WrapPanel> </Expander> </DataTemplate> </ListView.ItemTemplate> </ListView> </DockPanel>
Above the code returns ListBox items that are not represented in a row, but each item in a new row. I tried setting MinWidth, Width, etc. For WrapPanel and ListBox, but with no result.
Thanks in advance for all the related tips on how to get WrapPanel to fill it horizontally.
source share