This is a migrated thread and some comments may be shown as answers.

Mouse scrolling on RadWindow not working

3 Answers 101 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tolga
Top achievements
Rank 1
Tolga asked on 08 May 2009, 05:26 PM
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

3 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 12 May 2009, 03:10 PM
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.
0
Tolga
Top achievements
Rank 1
answered on 12 May 2009, 06:23 PM

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 { }

 

}


0
Miroslav Nedyalkov
Telerik team
answered on 14 May 2009, 12:32 PM
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.
Tags
Window
Asked by
Tolga
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Tolga
Top achievements
Rank 1
Share this question
or