Herry Markowitz
Herry Markowitz

Reputation: 308

How to click WPF ScrollViewer down button

Following picture shows my project.

My project

Here is XAML code for your testing needs.

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="200" Width="525">

<ScrollViewer Name="ScrollViewer1" Height="67" VerticalAlignment="Top">
    <StackPanel>
        <TextBox Name="TextBox1" Text="TextBox1"/>
        <TextBox Name="TextBox2" Text="TextBox2"/>
        <TextBox Name="TextBox3" Text="TextBox3"/>
        <TextBox Name="TextBox4" Text="TextBox4"/>
        <TextBox Name="TextBox5" Text="TextBox5"/>
        <TextBox Name="TextBox6" Text="TextBox6"/>
    </StackPanel>
</ScrollViewer>

</Window>

Following picture shows my question;

Question

So, how to click WPF ScrollViewer down button in order to go end of ScrollViwer?

Upvotes: 0

Views: 1208

Answers (2)

babgev
babgev

Reputation: 364

A solution could be to subscribe to the click of that button like here https://stackoverflow.com/a/4932118/6890102, then call the ScrollToEnd() method of the ScrollViewer. But there might be a better solution.

Upvotes: 1

Mr. Leeds
Mr. Leeds

Reputation: 164

Right-Click on ScrollViewer->Edit Template->Edit a Copy, to see the Scrollviewer's Template. The ScrollViewer contains a ScrollBar. A ScrollBar contains, RepeatButton, and a Track. The RepeatButton is responsible for the up and down movement of the scrollbar. Try checking it. You may find some idea on how to implement your objective.

Upvotes: 1

Related Questions