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 3720602
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:16:16+00:00 2026-05-19T05:16:16+00:00

A have ListBox and 4 Items. 2 visible 2 colpased: Click: -this bad! I

  • 0

A have ListBox and 4 Items.
2 visible
2 colpased:

alt text

Click:
alt text
-this bad!

I need this:

alt text

I need Set in reapeatButton change Interval!?!? how to do it

  • 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-05-19T05:16:18+00:00Added an answer on May 19, 2026 at 5:16 am

    What you want is for the list box to scroll by two lines for every one time you click the repeat buttons. Here is a behavior that you can add to your ListBox that will do just that.

    First add this namespace:

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    

    and the corresponding reference to your project.

    Then the XAML looks like this:

    <ListBox ScrollViewer.VerticalScrollBarVisibility="Visible" Height="40">
        <i:Interaction.Behaviors>
            <local:ScrollBehavior LineMultiplier="2"/>
        </i:Interaction.Behaviors>
        <ListBoxItem Content="Item1"/>
        <ListBoxItem Content="Item2"/>
        <ListBoxItem Content="Item3"/>
        <ListBoxItem Content="Item4"/>
    </ListBox>
    

    and here is the behavior:

    class ScrollBehavior : Behavior<FrameworkElement>
    {
        public int LineMultiplier
        {
            get { return (int)GetValue(LineMultiplierProperty); }
            set { SetValue(LineMultiplierProperty, value); }
        }
    
        public static readonly DependencyProperty LineMultiplierProperty =
            DependencyProperty.Register("LineMultiplier", typeof(int), typeof(ScrollBehavior), new UIPropertyMetadata(1));
    
        protected override void OnAttached()
        {
            AssociatedObject.Loaded += new RoutedEventHandler(AssociatedObject_Loaded);
        }
    
        private ScrollViewer scrollViewer;
    
        private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
        {
            scrollViewer = GetScrollViewer(AssociatedObject);
            scrollViewer.CommandBindings.Add(new CommandBinding(ScrollBar.LineUpCommand, LineCommandExecuted));
            scrollViewer.CommandBindings.Add(new CommandBinding(ScrollBar.LineDownCommand, LineCommandExecuted));
        }
    
        private void LineCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ScrollBar.LineUpCommand)
            {
                for (int i = 0; i < LineMultiplier; i++)
                    scrollViewer.LineUp();
            }
    
            if (e.Command == ScrollBar.LineDownCommand)
            {
                for (int i = 0; i < LineMultiplier; i++)
                    scrollViewer.LineDown();
            }
        }
    
        private ScrollViewer GetScrollViewer(DependencyObject o)
        {
            if (o is ScrollViewer)
                return o as ScrollViewer;
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(o); i++)
            {
                var result = GetScrollViewer(VisualTreeHelper.GetChild(o, i));
                if (result != null)
                    return result;
            }
            return null;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a styled listbox. Listbox items change color when hovered over and when
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>
I have a ListBox which displays items of variable height. I want to show
I have a ListBox displaying some items, and in certain modes I stamp a
well i have a listbox with some items inside. i want to detect a
I have a ListBox with way too many items in it and the UI
I have a ListBox containing a group of 'Expander' items, and what I would
I have a ListBox bound to a list of Items (for arguement, lets say
I have a listbox that displays Shipment Items (custom class) that are formatted using
I have a listbox in C# with the following items: Package1 Package2 Package3 Package4

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.