Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
my application is of type Silverlight. i want to trigger when user clicks on the border of the browser. for this purpose, i used this method:
public MainPage()
    bool bResult = System.Windows.Browser.HtmlPage.Window.AttachEvent("onmousedown", new EventHandler(this.eventHandler));
private void eventHandler(object sender, EventArgs e)
but the eventHandler is not called. why?
ps1. if i change "onmousedown" to "onresize" it's called.
ps2. bResult is true in both cases.
Posted 30-Apr-12 2:39am
Edited 30-Apr-12 2:40am
SAKryukov at 30-Apr-12 18:37pm
Why would you contaminate the site with all those numbers in the question titles? If you want, leave them in your own records, with your questions' URLs.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Clicking on the border will not generate an onmousedown event. The border does not belong to browser windows client area so no event will be generated. If you resize the window though, the client area will also change and thus the container for the root element resizes which triggers an onresize event.
Hope that clears it up a bit!
ilostmyid2 at 30-Apr-12 8:20am
so how can i grab the mouse events belong to the non-client area parts of the browser?
indeed i need to know when use release the left mouse button (mouse up). by this method i want to know when resize is done.
Manfred R. Bihy at 30-Apr-12 11:58am
1. Grabbing non client area mouseevents is IMHO impossible for browser based applications.
2. I'm not sure when a resize event is acutally fired. If the resize is only fired after the mouse button has been released then you'd also have the end of your resize operation. If the resize is being fired continually there is no way I know of to tell that the user finally stopped resizing the window by releasing the mouse button.
ilostmyid2 at 1-May-12 2:56am
thank u for ur answer
resize is continually generated.
the fact is that the event might be raised, because we've ResizeEnd in a form application and essentially all windows receive WM_EXITSIZEMOVE and this could not be neglected. this is the fault of MS that it doesn't capture the message and dispatch it throw Silverlight.
but, since the message EXISTS, there must be a way or workaround to write an unmanaged code to capture it.
any suggestion?
SAKryukov at 30-Apr-12 18:35pm
That is correct, a 5.
Manfred R. Bihy at 2-May-12 7:00am
Thanks SA!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 685
1 Maciej Los 290
2 Richard Deeming 185
3 Suvendu Shekhar Giri 184
4 Abhinav S 166
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 30 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100