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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:31:45+00:00 2026-06-11T15:31:45+00:00

I have a scrollviewer control. Its coding <Window.Resources> <DataTemplate x:Key=listBoxItemTemplate> <TextBlock /> </DataTemplate> <ItemsPanelTemplate

  • 0

I have a scrollviewer control. Its coding

<Window.Resources>        
    <DataTemplate x:Key="listBoxItemTemplate">
        <TextBlock />
    </DataTemplate>
    <ItemsPanelTemplate x:Key="itemsPanelTemplate">
        <VirtualizingStackPanel Orientation="Horizontal"/>
    </ItemsPanelTemplate>
</Window.Resources>
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="0"/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <RepeatButton x:Name="LineLeftButton" 
                Grid.Column="0"
                Grid.Row="1"
                Content="&lt;"      
                Command="{x:Static ScrollBar.LineLeftCommand}"      
                CommandTarget="{Binding ElementName=scrollViewer}"/>
    <RepeatButton x:Name="LineRightButton" 
                Grid.Column="2"
                Grid.Row="1"
                Content="&gt;" 
                Command="{x:Static ScrollBar.LineRightCommand}"      
                CommandTarget="{Binding ElementName=scrollViewer}"/>
    <ScrollViewer Grid.Column="1" Grid.Row="1"  x:Name="scrollViewer" 
                  VerticalScrollBarVisibility="Hidden" 
                  HorizontalScrollBarVisibility="Hidden">
        <ListBox Name="lst2"
                 Margin="0,0,0,0"
                 VerticalAlignment="Stretch" 
                 ItemsPanel="{StaticResource itemsPanelTemplate}"/>
    </ScrollViewer>
</Grid>

enter image description here

I want to disable repeat buttons when there is no data at that end.

That is to say when I am scrolling my Listbox data and at the end when no data is available at that particular side (i.e., left, right) then that side RepeatButton will be disabled. When I am scrolling reverse then the said RepeatButton will be enabled.

I am showing a graphical representation here. I am sure that can clarify properly.

Image1:

enter image description here

Please check the RepeatButton is disabled at the left side as no data to be scrolled at left.

Image2:

enter image description here

Please check the RepeatButton is disabled at the right side now as no data to be scrolled at right.

This type of scrolling is what I am trying to achieve. I read Wpf disable repeatbuttons when scrolled to top/bottom but of no use.

  • 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-11T15:31:47+00:00Added an answer on June 11, 2026 at 3:31 pm

    Yes, it is easy.

    • Get rid of your ScrollViewer
    • Subclass ListBox component and add new property CanScrollHorizontallyLeft/Right
    • Hook into ListBox’s ScrollBar.Scroll event, like : <ListBox ScrollBar.Scroll="event_handler" />
    • Add the detection and change properties accordingly.

      private void scroll_handler(object sender, ScrollEventArgs e) {
         ScrollBar sb = e.OriginalSource as ScrollBar;
      
         if (sb.Orientation == Orientation.Horizontal)
             return;
      
         if (sb.Value == sb.Maximum) {
             Debug.Print("At the bottom of the list!");
      }
      

      }

    Alternatiely, ScrollViewer might expose ScrollBar.Scroll event too and you dont have to subclass/make new properties. YOu can do the logic inside scroll_handler and change commands CanExecute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an items control on my window and when its double clicked I
I have a scrollview control that has a StackPanel (Orientation=Vertical) UI Element inside of
I have created a Rectangle inside of a ScrollViewer like this <ScrollViewer ManipulationMode=Control x:Name=songScrollViewer
I have the following code currently: <DataTemplate DataType={x:Type vm:SectionViewModel}> <ScrollViewer> <ItemsControl ItemsSource={Binding ViewModels}> </ItemsControl>
I have a horizontal UIScrollview set up (meaning its not one that scrolls up
Using WPF, I have a ListBox control with a DataTemplate inside it. The relevant
I have a TreeView control on my WPF window. I am giving only relevant
I have the following controls: <UserControl > <!--<ScrollViewer >--> <Viewbox > <Canvas/> </Viewbox> <!--</ScrollViewer>-->
I have an ScrollViewer that I am trying to do data binding on the
I'm developing a WPF app in which I have a ScrollViewer with grid (16

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.