SYL
SYL

Reputation: 337

UWP ListView in ContentDialog not scrolling

C# UWP Windows 10

This is a XAML code of my contentdialog:

 <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>

    .....

    <Grid Grid.Row="1" Grid.ColumnSpan="2">
        <ListView x:Name="MerchantList"                
            ItemTemplate="{StaticResource MerchantListViewTemplate}"
            SelectionMode="Single"
            SelectedValue="{Binding currItemId, Mode=TwoWay}"
            SelectedValuePath="Id"
            ShowsScrollingPlaceholders="True">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="Margin" Value="0"/>
                    <Setter Property="Padding" Value="0"/>
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
    </Grid>
</Grid>

I need to show List of some items to user, but ListView not scrolling. How to fix it?

Upvotes: 0

Views: 1299

Answers (2)

Mohamed Saqer
Mohamed Saqer

Reputation: 177

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>



    <Grid Grid.Row="1" Grid.ColumnSpan="2">
        <ScrollViewer VerticalScrollMode="Enabled" HorizontalScrollMode="Enabled" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
        <ListView x:Name="MerchantList"                
        ItemTemplate="{StaticResource MerchantListViewTemplate}"
        SelectionMode="Single"
        SelectedValue="{Binding currItemId, Mode=TwoWay}"
        SelectedValuePath="Id"
        ShowsScrollingPlaceholders="True">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="Margin" Value="0"/>
                    <Setter Property="Padding" Value="0"/>
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>
        </ScrollViewer>
    </Grid>
</Grid>

try this ....

Upvotes: 0

M. Pipal
M. Pipal

Reputation: 734

Try to set some "non-Auto" size of columns and rows (pixels or stars, doesn't matter). I really wasn't able to find out any reason of this behavior in documentation, but in my case it helped.

Upvotes: 2

Related Questions