Mouse scrolling on RadWindow not working

4 posts, 0 answers
  1. Tolga
    Tolga avatar
    28 posts
    Member since:
    Jun 2007

    Posted 08 May 2009 Link to this post

    Hi:

    I have a regular Silverlight 2 application. On one screen I offer the user to zoom in on an image. For that I am capturing the mouse scroll event. That is all working.

    A new request was, to open the image in a RadWindow and do the scrolling there instead, however, the mouse scroll events are not being triggered when the Radwindow is open.

    Any ideas?

    thanks

    --tolga
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 12 May 2009 Link to this post

    Hello Tolga,

    We did some tests at our side and the scrolling was working as we expected. Could you please open a support ticket and send us a sample project that reproduces the problem. Thank you!

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. DevCraft banner
  4. Tolga
    Tolga avatar
    28 posts
    Member since:
    Jun 2007

    Posted 12 May 2009 Link to this post

    Great, so can you enlighten me then how I can get it to work as well. Here is my code...
    It works on any Silverlight page expect the Radwindow. Are those events not right for the rad window? Do I need to use UI Automation? If so, how..

    Thanks

    --tolga

     

     

    HtmlPage.Window.AttachEvent("DOMMouseScroll", OnMouseWheel);

     

     

    HtmlPage.Window.AttachEvent("onmousewheel", OnMouseWheel);

     

     

    HtmlPage.Document.AttachEvent("onmousewheel", OnMouseWheel);

     


    ...

     

    private void OnMouseWheel(object sender, HtmlEventArgs args)

     

    {

     

    try

     

    {

     

    Double mouseDelta = 0;

     

     

    ScriptObject e = args.EventObject;

     

     

    Boolean bLetGrow = false;

     

     

    Boolean bLetShrink = false;

     

     

    // Mozilla and Safari

     

     

    if (e.GetProperty("detail") != null)

     

    mouseDelta = ((

    double)e.GetProperty("detail"));

     

     

    // IE and Opera

     

     

    else if (e.GetProperty("wheelDelta") != null)

     

    mouseDelta = ((

    double)e.GetProperty("wheelDelta"));

     

    mouseDelta =

    Math.Sign(mouseDelta);

     

     

    int index = (mouseDelta > 0) ? 1 : -1;

     

     

    if (this.imgDetail.Source != null)

     

    {

    dNewLeftEllipseFromScroller = dNewLeftEllipseFromScroller + (index * 10);

     

    if (dNewLeftEllipseFromScroller > dMaxPosition)

     

    {

    bLetGrow =

    false;

     

    dNewLeftEllipseFromScroller = dMaxPosition;

    }

     

    else

     

    bLetGrow =

    true;

     

     

     

    if (dNewLeftEllipseFromScroller < dMinPosition)

     

    {

    bLetShrink =

    false;

     

    dNewLeftEllipseFromScroller = dMinPosition;

    }

     

    else

     

    bLetShrink =

    true;

     

     

     

    if (dNewLeftEllipseFromScroller >= dMinPosition && dNewLeftEllipseFromScroller <= (dMaxPosition))

     

     

    this.cvsEllSlider.SetValue(Canvas.LeftProperty, dNewLeftEllipseFromScroller);

     

     

     

    if (index == 1)

     

    {

     

    if (bLetGrow == true)

     

    {

    ZoomScale += 0.1;

    ZoomScale += 0.1;

    }

    }

     

    else

     

    {

     

    if (bLetShrink)

     

    {

    ZoomScale -= 0.1;

    ZoomScale -= 0.1;

    }

    }

     

    if (ZoomScale <= 0)

     

    {

    ZoomScale = 0.1;

    ZoomScale = 0.1;

    }

     

    this.slImage.ScaleX = ZoomScale;

     

     

    this.slImage.ScaleY = ZoomScale;

     

    }

    }

     

    catch { }

     

    }


  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 14 May 2009 Link to this post

    Hello Tolga,

    We've tested with the events the Mouse class that is in the Telerik.Windows.Controls assembly. I believe that the problem is caused by one of the following reasons:
     - the code you posted doesn't work as the code implemented in the Telerik.Windows.Input.Mouse class
     - the RadWindow control is shown (the Show or ShowDialog method is called) before the Loaded event was fired.

    Please make sure that you call the Show or ShowDialog methods after the Loaded event of the Page was fired. If this doesn't work, try to use the Telerik.Windows.Input.Mouse.AddMouseWheelHandler method to add handler for the mouse scroll and use it.

    Please, let me know if this doesn't help.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Back to Top