W
W
wolfak2014-02-13 18:31:20
Programming
wolfak, 2014-02-13 18:31:20

Why doesn't scrolling work in XAML?

Good evening. Faced such problem... Vertical scrollbar is not displayed in XAML. Maybe I'm not using it correctly.

<Grid Background="#ffebdd" Grid.Column="2">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"></ColumnDefinition>
            <ColumnDefinition Width="5"></ColumnDefinition>
            <ColumnDefinition ScrollViewer.VerticalScrollBarVisibility="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Vertical" Background="#ffebdd" Grid.Column="0" x:Name="blocks">
            <Image Width="144" Height="47" Margin="0,30,0,20" Stretch="None" Source="ms-appx:///Images/logo.png"/>
            <Button BorderThickness="2" x:Name="testbut" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Истории</Button>
            <Button BorderThickness="2" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Зарегистрироваться</Button>
            <Button BorderThickness="2" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Войти</Button>
        </StackPanel>
        <StackPanel Orientation="Vertical" Background="#d9d9ff" Grid.Column="1">
            <TextBlock FontSize="22" Foreground="#78239b" Margin="30">Одно дождливое утро</TextBlock>
        </StackPanel>
<StackPanel Orientation="Vertical" Background="#ffebdd" Grid.Column="2" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <TextBlock FontSize="18" Foreground="#000" TextWrapping="Wrap" Margin="30,10,30,0">Контент который по размеру не помещается на страницу</TextBlock>
<TextBlock FontSize="18" Foreground="#000" TextWrapping="Wrap" Margin="30,10,30,0">Контент который по размеру не помещается на страницу</TextBlock>
<TextBlock FontSize="18" Foreground="#000" TextWrapping="Wrap" Margin="30,10,30,0">Контент который по размеру не помещается на страницу</TextBlock>
        </StackPanel></Grid>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Andreev, 2014-02-15
@wolfak

to scroll, you need to use ScrollViewer like this:

<ScrollViewer VerticalScrollBarVisibility="Auto">
    <StackPanel>
        ...
    </StackPanel>
</ScrollViewer>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question