Adpative Listview to adjust according to screen size for UWP xaml app

85 views Asked by At

Listview contents multiple item like textblock how can we make it the list view adaptive as per the screen resolution where the grid contains multiple boxs of listview. Need to adjust below similar xaml page listitem and text as per sceen changes

enter image description here

1

There are 1 answers

0
Nico Zhu On

For your requirement, you could use WrapPanel Xaml Control to approach. you just replace the default ListView ItemsPanelTemplate with WrapPanel. For more detail you could refer the following code.

<ListView Name="WrapPanelContainer"
          IsItemClickEnabled="True"
          ItemTemplate="{StaticResource PhotoTemplate}">
  <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
      <controls:WrapPanel Background="{ThemeResource Brush-Grey-04}"
                          Padding="0,0,0,0"
                          VerticalSpacing="5"
                          HorizontalSpacing="5" />
    </ItemsPanelTemplate>
  </ItemsControl.ItemsPanel>
</ListView>