Click here to Skip to main content
11,932,103 members (65,268 online)
Rate this:
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 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 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 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 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 30-Apr-12 18:35pm
That is correct, a 5.
Manfred R. Bihy 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.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