Page view counter
How did I manage Scroll Bar
Last post 09-16-2008 6:39 AM by nirav123. 4 replies.
Sort Posts:
09-05-2008 12:40 AM
How did I manage Scroll Bar

Hello Everyone there

I had developed  a SL2B2 application.I used scrollbar of SL and not the default one.It is working fine But my problem is I am not able to scroll the page through mouse(scrollwheel).Also at one place there is a form to be submitted,which is having enough height,after submit button(at the end of the page) is clicked,forms visibility is set to collapsed and other stackpanel is set to visible which is not having much height,so when button is clicked,I want to goto the top of the page by default how could I do this.

nirav123

Loading...
Joined on 08-14-2008
Posts 5
09-05-2008 9:46 AM
Re: How did I manage Scroll Bar

I don't think mouse wheel scrolling isn't supported yet in beta.  I imagine this is something we'll see in the official release.

 To move to the top of your scrollable area programmatically, you'll want to use:

 nameOfScrollViewer.ScrollToVerticalOffset(0)

ccoombs

Loading...
Joined on 02-08-2008
Posts 215
09-07-2008 2:08 PM
Re: How did I manage Scroll Bar
I also found mouse wheel scrolling isn't working in beta.

Ccoombs reply is absolutely the answer of this post.

Amyo Kabir
Solution Architect & Sr. Developer
http://amyotech.spaces.live.com/

amyo

Loading...
Joined on 01-07-2008
Bangladesh
Posts 112
09-07-2008 5:28 PM
Marked as Answer
Re: How did I manage Scroll Bar

I found this while working on some Deep Zoom stuff.  It works there.  I haven't time to put together an example so I don't know if it will help you in what you are trying to do.  These event handlers are catching the mouse wheel event though, in a UserControl that I quickly threw together.  (But I dought the logic in the handler is of much use to you.)

if ( HtmlPage.IsEnabled )
{
   HtmlPage.Window .AttachEvent ( "DOMMouseScroll", HandleHtmlMouseWheel );
   HtmlPage.Window .AttachEvent ( "onmousewheel", HandleHtmlMouseWheel );
   HtmlPage.Document .AttachEvent ( "onmousewheel", HandleHtmlMouseWheel );
}

 

private void HandleHtmlMouseWheel ( object sender, HtmlEventArgs args )
{
   double delta = 0;

   ScriptObject eventObj = args.EventObject;

   if ( eventObj.GetProperty( "wheelDelta" ) != null
   {
      delta = ((
double)eventObj.GetProperty( "wheelDelta" ) ) / 120;

      if ( HtmlPage.Window.GetProperty( "opera" ) != null )
         delta = -delta;
   }

   else if ( eventObj.GetProperty( "detail" ) != null
   {
      delta = -((double)eventObj.GetProperty( "detail" ))/3;
      if ( HtmlPage.BrowserInformation.UserAgent.IndexOf( "Macintosh" ) != -1 )
         delta = delta * 3;
   }

 

   if ( delta != 0 ) 
   {
      MouseWheelEventArgs wheelArgs = new MouseWheelEventArgs ( delta );

      if
( wheelArgs.Handled )
         args.PreventDefault();
   }
}

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
K2P2@subtopic.cc, www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Denver, Colorado
Posts 129
09-16-2008 6:39 AM
Re: Re: How did I manage Scroll Bar
Thanks for help But I had not been able to check it out due lots of other work I am really sorry for that.But as soon as I start my SL project I will chk this and get back to you.
nirav123

Loading...
Joined on 08-14-2008
Posts 5
Microsoft Communities