Tag Archives: XAML

UWP Resize ContentDialog MaxWidth & MaxHeight

To Resize (eventually edit the Height or Width to a higher value) the ContentDialog(s) you need to add the following lines to your App.xaml file and edit the Max values as you wish.

<Application.Resources>
    <x:Double x:Key="ContentDialogMaxWidth">1000</x:Double>
    <x:Double x:Key="ContentDialogMaxHeight">1000</x:Double>
</Application.Resources>

 

UWP XAML Make ListView ScrollVierwer “scrollable”

The Key to successfully make a ListView scrollable is to set a Value to the Height property of the ListView as shown below in the highlighted rows.

<StackPanel Grid.Column="0" Grid.Row="0" Margin="4,2,0,0">
    <uwp:HeaderedTextBlock Text="Header Title"  />
    <ListView x:Name="lvwMyEntities" 
              Height="300"
              ItemsSource="{x:Bind local:Collections.MyEntities}" 
              SelectionMode="Single" 
              MinHeight="150" 
              Grid.Row="0"
              ScrollViewer.VerticalScrollBarVisibility="Visible">
        <ListView.ItemTemplate>
            <DataTemplate x:DataType="local:MyEntity">
                <Grid Width="150" Height="150">
                <Border BorderBrush="DarkGray" BorderThickness="0.5" >

                    <StackPanel Orientation="Vertical" VerticalAlignment="Center"
                                        AllowDrop="true" DragEnter="PnlMyEntity_DragEnter" DragLeave="PnlMyEntity_DragLeave" DragOver="PnlMyEntity_DragOver" Drop="PnlMyEntity_Drop" DropCompleted="PnlMyEntity_DropCompleted">
                        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" FontWeight="Bold" Text="{x:Bind DisplayName}" 
                                           FontSize="14" TextWrapping="WrapWholeWords" Margin="2"/>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Bottom" Background="White">
                                <Image HorizontalAlignment="Center" VerticalAlignment="Bottom" Source="{x:Bind Image}" Stretch="Uniform" />
                        </StackPanel>
                    </StackPanel>
                </Border>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <ItemsWrapGrid x:Name="lvwPnlApo" Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
    </ListView>
</StackPanel>