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

  • Home
  • SEARCH
  • 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 8154991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:32:07+00:00 2026-06-06T16:32:07+00:00

I have created a Rectangle inside of a ScrollViewer like this <ScrollViewer ManipulationMode=Control x:Name=songScrollViewer

  • 0

I have created a Rectangle inside of a ScrollViewer like this

<ScrollViewer ManipulationMode="Control" x:Name="songScrollViewer"  HorizontalScrollBarVisibility="Visible"  VerticalScrollBarVisibility="Disabled" Height="270" VerticalAlignment="Center" Width="728" Canvas.Top="20" d:LayoutOverrides="HorizontalMargin"   >
  <Rectangle x:Name="musicBG" Fill="#FF0692FD"/>
</ScrollViewer>

During the use of the app, the size of MusicBg changes, sometimes to something around 3,000 pixels width.

musicBG.Width = _songLength*PixelsPerSecond

However, while scrolling the scrollViewer, it allows me to scroll the rectangle all the way off the screen.

For example this line of code gives me the following values when I have moved the rectangle as far as I want to move it.

if (songScrollViewer.HorizontalOffset > songScrollViewer.ScrollableWidth)

HorizontalOffset has a value of ~1200 and ScrollableWidth has a value of about ~2900.

How can I get this to be done properly so that the rectangle is not scrolled completely off the screen?

I would expect a HorizontalOffset of about 1200 to only push the rectangle about halfway through to it’s destination, and not make it start going off screen.

ANSWER:

After much frustration, I was able to solve this problem by using Canvas instead of Border or Rectangle.
I’ll award points if anyone can explain why this problem happened, and if there is a less processor intensive control that would work better than canvas.

Edit: Screen shots:

Bad Code:

<ScrollViewer ManipulationMode="Control" x:Name="songScrollViewer" Width="720"  HorizontalScrollBarVisibility="Visible"  VerticalScrollBarVisibility="Disabled" Height="270" VerticalAlignment="Top" Canvas.Top="20" HorizontalAlignment="Left"   >
                                    <Border x:Name="musicBG"   Background="#FF0692FD" VerticalAlignment="Top" HorizontalAlignment="Left" Height="270" />

            </ScrollViewer>

Image of bad scroll with bad code:
bad scroll

Good working code:

<ScrollViewer ManipulationMode="Control" x:Name="songScrollViewer" Width="720"  HorizontalScrollBarVisibility="Visible"  VerticalScrollBarVisibility="Disabled" Height="270" VerticalAlignment="Top" Canvas.Top="20" HorizontalAlignment="Left"   >
                <Canvas x:Name="musicBG"  Background ="#FF0692FD" Height="270" >
                    <Border   Background="#FF0692FD" VerticalAlignment="Top" HorizontalAlignment="Left" Height="270" />
                </Canvas>
            </ScrollViewer>

Good Scroll: Notice it says 170 seconds on the bottom right instead of the smaller number of 118 seconds in the bad scroll.
good scroll

  • 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-06T16:32:09+00:00Added an answer on June 6, 2026 at 4:32 pm

    I believe your right, wp7 won’t render shapes that are bigger then 2048 pixels. So the reason it’s scrolling of the page is because it’s treating it as if it were bigger then 2048 but you can only see up to a width of 2048px and its just scrolling over to the “ghost” part of the rectangle.

    I’m not sure if you can override this but the best solution I could come up with (without overriding) is by splitting up your rectangle into chucks that are smaller then 2000 (just to be safe) and then displaying them seamlessly in a horizontal stack panel inside the scroll viewer. The problem with this is that depending on how you’ve coded it, this solution might be hard to implement; but you might just be able to split it in your ViewModel when displaying it and your logic would only see it as one big chunk.

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

Sidebar

Related Questions

I have created a rectangle now I have to put one JLabel into this.
I have some shaped created using flex primitive classes like ellipse , rectangle, path
I have a rectangle that I've created and set its individual properties like so
i created rectangle shape user control and i am using this user control in
I have a function as part of a rectangle class (points inside it are
I am having an issue where I have created a Custom Control and when
I have a UIView control (white rectangle in image) Moreover I am able to
I have created rectangle shapes using onDraw method, filled with single colors. Now I
I have created a user control in Silverlight which basically animates the size of
I created a UserControl with a Label and a Rectangle inside 2 grid rows.

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.