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