Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9324803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:41:24+00:00 2026-06-19T04:41:24+00:00

I have list box with 10 items. By default vertical scroll is enabled and

  • 0

I have list box with 10 items.
By default vertical scroll is enabled and i can see first 3 items.
Customer wants me to add 2 buttons “UP” and “down” and on a button click list box should show next 3 items.

For example i want to show by “down” click item 4,item 5, item 6.

enter image description here

How its possible to do with default WPF controls listbox and scrollview?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:41:25+00:00Added an answer on June 19, 2026 at 4:41 am

    You can use ScrollViewer.ScrollToVerticalOffset method (msdn).

    Example:

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="50" />
            <RowDefinition Height="20" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>
    
        <Button x:Name="btnUp" Content="UP" Click="btnUp_Click" />
    
        <ScrollViewer x:Name="scroll" Grid.Row="1">
            <ListBox x:Name="lbData">
                <ListBoxItem>Item1</ListBoxItem>
                <ListBoxItem>Item2</ListBoxItem>
                <ListBoxItem>Item3</ListBoxItem>
                <ListBoxItem>Item4</ListBoxItem>
                <ListBoxItem>Item5</ListBoxItem>
                <ListBoxItem>Item6</ListBoxItem>
                <ListBoxItem>Item7</ListBoxItem>
                <ListBoxItem>Item8</ListBoxItem>
                <ListBoxItem>Item9</ListBoxItem>
                <ListBoxItem>Item10</ListBoxItem>
            </ListBox>
        </ScrollViewer>
    
        <Button x:Name="btnDown" Content="Down" Click="btnDown_Click" Grid.Row="2" />
    
        <StackPanel Grid.Row="3" Orientation="Horizontal">
            <TextBlock Text="Start with:" Margin="2" />
            <ComboBox x:Name="cbIndex" Loaded="cbIndex_Loaded" Margin="2" />
            <Button x:Name="btnGo" Content="GO" Click="btnGo_Click" Margin="2" />
        </StackPanel>
    </Grid>
    

    Code-behind:

    private void btnUp_Click(object sender, RoutedEventArgs e)
    {
        scroll.ScrollToVerticalOffset(scroll.VerticalOffset - 50);
    }
    
    private void btnDown_Click(object sender, RoutedEventArgs e)
    {
        scroll.ScrollToVerticalOffset(scroll.VerticalOffset + 50);
    }
    
    public double GetOffset(int itemIndex)
    {
        double result = 0;           
        for (int i = 0; i < itemIndex; i++)
        {
            result += (lbData.Items[i] as ListBoxItem).ActualHeight;
        }
    
        return result;
    }
    
    private void cbIndex_Loaded(object sender, RoutedEventArgs e)
    {
        cbIndex.ItemsSource = Enumerable.Range(1, lbData.Items.Count);
    }
    
    private void btnGo_Click(object sender, RoutedEventArgs e)
    {
        scroll.ScrollToVerticalOffset(GetOffset(cbIndex.SelectedIndex));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a list box with different items, each with unique values, and
I have a list box control that contains enough items to list them with
I have two ListBoxes. First ListBox items are list of Products. and second ListBox
Using Symfony and Doctrine, I have a multi-select list box. The multiple default values
I have a dropdown box which only shows active items in the list. But
I have a list box and i am trying to get currently checked item
In my project, I have a list box. When I click an item on
I have a list box with options the itemValue is a String and the
I have a combo box with a list of font sizes that I am
I am using MVVM light and have a list box with multiple selection. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.