Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Listview rows & columns resize when windows resize

$
0
0

Hello,

I am new to WPF and I am having trouble re-sizing my Listview columns and rows to fit the window when the window re-sizes. I am planning to have paging on the Listview so I would only show 10 rows at a time. When the user maximize the window. I want the 10 rows to expand bigger to fit the window. When the window shrinks, I want the 10 rows to shrinks and fit all the content inside that window.

Thanks.

<Control.Resources>       <DataTemplate x:Key="Type"><StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"><Border BorderThickness="2" BorderBrush="Black"><Image x:Name="PicCellName" Height="40" MinWidth="50" Source="{Binding Type}"  /></Border></StackPanel></DataTemplate><DataTemplate x:Key="Language"><StackPanel Orientation="Horizontal" Margin="0,0,0,0"><Border BorderThickness="2" BorderBrush="Black"><Image x:Name="PicCellName" Height="40" MinWidth="50" Source="{Binding Language}"  /></Border></StackPanel></DataTemplate>        <DataTemplate x:Key="Descriptions"><StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Margin="0,0,0,0"><Border BorderThickness="2" BorderBrush="Black"><TextBlock Background="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Center" Margin="0,0,0,0"><InlineUIContainer>            			            			                                     </InlineUIContainer><Run Text="{Binding Descriptions}" FontSize="37" Foreground="CadetBlue"/></TextBlock></Border></StackPanel></DataTemplate><DataTemplate x:Key="Popularity"><StackPanel Orientation="Horizontal" Margin="0,0,0,0" ><Border BorderThickness="2" BorderBrush="Black"><Image x:Name="PicCellName" Height="40" MinWidth="50" Source="{Binding Popularity}"  /></Border></StackPanel></DataTemplate></Control.Resources><Grid><ListView x:Name="ResultsLstVw" ScrollViewer.HorizontalScrollBarVisibility="Disabled">            <ListView.View>               <GridView>                    <GridViewColumn Width="68" CellTemplate="{StaticResource Type}"  /><GridViewColumn Width="80" CellTemplate="{StaticResource Language}" />                    <GridViewColumn Width="68" CellTemplate="{StaticResource Popularity}" /><GridViewColumn Width="Auto" CellTemplate="{StaticResource Descriptions}" />                    </GridView>                </ListView.View>                </ListView>        </Grid>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>