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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:38:32+00:00 2026-05-25T00:38:32+00:00

Consider the following XAML (a UserControl): <Grid x:Name=LayoutRoot ScrollViewer.VerticalScrollBarVisibility=Disabled> <Grid HorizontalAlignment=Right Width=335.312 ScrollViewer.VerticalScrollBarVisibility=Disabled> <ed:BlockArrow

  • 0

Consider the following XAML (a UserControl):

<Grid x:Name="LayoutRoot" ScrollViewer.VerticalScrollBarVisibility="Disabled">
    <Grid HorizontalAlignment="Right" Width="335.312" ScrollViewer.VerticalScrollBarVisibility="Disabled">
        <ed:BlockArrow Fill="#FFF4F4F5" HorizontalAlignment="Left" Margin="0" Orientation="Left" Stroke="Black" Width="15" RenderTransformOrigin="5.6,-0.412" Height="12" VerticalAlignment="Center" MouseEnter="LeftArrow_MouseEnter" MouseLeave="LeftArrow_MouseLeave" MouseLeftButtonUp="LeftArrow_MouseLeftButtonUp"/>
        <ed:BlockArrow Fill="#FFF4F4F5" Stroke="Black" RenderTransformOrigin="5.6,-0.412" Height="12" VerticalAlignment="Center" MouseEnter="RightArrow_MouseEnter" MouseLeave="RightArrow_MouseLeave" HorizontalAlignment="Right" Width="15" MouseLeftButtonUp="RightArrow_MouseLeftButtonUp"/>
        <ScrollViewer x:Name="panelScrollViewer" Margin="15,0" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden">
            <StackPanel x:Name="slidingStackPanel" Orientation="Horizontal" Height="125.882" Width="305.312" ScrollViewer.VerticalScrollBarVisibility="Disabled" CanHorizontallyScroll="True" ScrollViewer.CanContentScroll="False"/>
        </ScrollViewer>
    </Grid>
</Grid>

I am looking to physically scroll this stackpanel. I dynamically add elements to the stackpanel, and this appears to work correctly. In another button’s click function, the following code is executed:

panelScrollViewer.ScrollToHorizontalOffset(100);

The scrollview and the stackpanel’s HorizonalOffset is still zero! Also, the stackpanel’s ScrollOwner is null. Any ideas?

  • 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-25T00:38:33+00:00Added an answer on May 25, 2026 at 12:38 am

    Since you do not specify a width of the ScrollViewer, it takes the size of the StackPanel. Because the content of the ScrollViewer is not larger than its size then it will not scroll and will always have a horizontal offset of 0. Try setting the width of the ScrollViewer to something smaller than its contents and you should have a working horizontal scroll.

    Also remove all the redundancy of disabling the vertical scroll bars, once is good enough.

    <Grid x:Name="LayoutRoot">
    <Grid HorizontalAlignment="Right" Width="335.312">
        <ed:BlockArrow Fill="#FFF4F4F5" HorizontalAlignment="Left" Margin="0" 
             Orientation="Left" Stroke="Black" Width="15" RenderTransformOrigin="5.6,-0.412"
             Height="12" VerticalAlignment="Center" MouseEnter="LeftArrow_MouseEnter" 
             MouseLeave="LeftArrow_MouseLeave" MouseLeftButtonUp="LeftArrow_MouseLeftButtonUp"/>
        <ed:BlockArrow Fill="#FFF4F4F5" Stroke="Black" RenderTransformOrigin="5.6,-0.412" 
             Height="12" VerticalAlignment="Center" MouseEnter="RightArrow_MouseEnter" 
             MouseLeave="RightArrow_MouseLeave" HorizontalAlignment="Right" Width="15" 
             MouseLeftButtonUp="RightArrow_MouseLeftButtonUp"/>
        <ScrollViewer x:Name="panelScrollViewer" Margin="15,0" CanContentScroll="False" 
              VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden"
              Width="250">
            <StackPanel x:Name="slidingStackPanel" Orientation="Horizontal" Height="125.882" Width="305.312"/>
        </ScrollViewer>
    </Grid>
    

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

Sidebar

Related Questions

Consider the following, simple code: XAML: <Grid Height=60 Name=grid> <Grid.ColumnDefinitions> <ColumnDefinition Width=162* /> <ColumnDefinition
Consider the following piece of Xaml <Grid Background=Blue> <Border Width=100 Height=60 BorderBrush=Black BorderThickness=2> <Border
Consider the following XAML: <ComboBox Name=CompanyComboBox HorizontalAlignment=Stretch ItemsSource={Binding Path=GlobalData.Companies} SelectedValuePath=Id SelectedValue={Binding Customer.CompanyId, ValidatesOnDataErrors=True} DisplayMemberPath=Name
Consider following XAML: <Window x:Class=WpfApplication1.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <StackPanel> <TextBlock Text={Binding Dic[foo]}
Consider the following Control/Template <my:ExpandingListBox Margin=0,2,0,0 x:Name=TagSearchListBox> <my:ExpandingListBox.Template> <ControlTemplate TargetType={x:Type my:ExpandingListBox}> <Border Name=MyBorder BorderThickness=2
Consider the following code: <Window x:Class=WpfApplicationWPF.CommandsWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=CommandsWindow Height=300 Width=300 PreviewMouseUp=Window_PreviewMouseUp MouseUp=Window_MouseUp >
Consider the following XAML: <Window x:Class=ContextMenuEvent.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525 ContextMenuOpening=Window_ContextMenuOpening> <Grid> <Button>Ok</Button>
Consider the following XAML file: <Window x:Class=ExpressionVisualizer.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:sle=clr-namespace:System.Linq.Expressions;assembly=System.Core Title=MainWindow Height=350 Width=525> <Window.Resources>
Consider the following xaml snippet: <ToolBarTray> <ToolBar Band=1 BandIndex=1> <Button>Go</Button> <Separator></Separator> <Button>Camera 1</Button> <Button>Camera
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)

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.