Sam Alex
Sam Alex

Reputation: 442

Wrap Panel with scroll viewer

I am using WrapPanel for dynamic content display line by line order like windows explorer windows, its working but when the horizontal and vertical ScrollBar enabled the WrapPanel display the contents are single line. Here we have contents less than 4 it shows perfect otherwise display single line.

Here is my xaml code

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0,10">
            <ItemsControl ItemsSource="{Binding Designs}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                            <TextBlock HorizontalAlignment="Left" Margin="200,11,0,0" TextWrapping="Wrap" Text="{Binding DsnName}" VerticalAlignment="Top" FontSize="16" FontFamily="Segoe UI Semibold" Foreground="#FF878787"/>
                            <Image Source="{Binding Image,FallbackValue={StaticResource Lost},TargetNullValue={StaticResource Lost},Mode=TwoWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Left" Margin="10,10,0,10" Width="174"/>
                            <CheckBox HorizontalAlignment="Right" Margin="0,14,12,0" VerticalAlignment="Top" Width="16"/>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
        </ItemsControl>
        </ScrollViewer>

How can fix this issue

Upvotes: 1

Views: 874

Answers (1)

Sam
Sam

Reputation: 349

Set height of WrapPanel or disable scrolling

Upvotes: 1

Related Questions