![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | how to get focused item in a page I've got a browser-like WPF app, and would like to know what element in my page currently is focused. There seems to be no 'currentfocus' element in a page, and I'm a bit stumped how to get the current focus of my app/page. Probably I'm missing something very obvious here ![]() Can someone help? Thanks, Sam |
| | #2 (permalink) |
| Guest | Re: how to get focused item in a page > I've got a browser-like WPF app, and would like to know what element > in my page currently is focused. > > There seems to be no 'currentfocus' element in a page, and I'm a bit > stumped how to get the current focus of my app/page. > Probably I'm missing something very obvious here ![]() > Can someone help? Check out the static FocusManager::FocusedElement[1] property. HTH, Drew [1] http://windowssdk.msdn.microsoft.com...edelement.aspx ___________________________________ Drew Marsh Chief Software Architect Mimeo.com, Inc. - http://www.mimeo.com Microsoft C# / WPF MVP Weblog - http://blog.hackedbrain.com/ |
| | #3 (permalink) |
| Guest | Re: how to get focused item in a page Drew Marsh schrieb: > > There seems to be no 'currentfocus' element in a page, and I'm a bit > > stumped how to get the current focus of my app/page. > > Probably I'm missing something very obvious here ![]() > > Can someone help? > > Check out the static FocusManager::FocusedElement[1] property. I tried FocusManager.GetFocusedElement(), but it always returns null in my case ![]() I'll dig around the FocusManager some more tomorrow though, thanks. Sam |
| | #4 (permalink) |
| Guest | Re: how to get focused item in a page Sam Jost wrote: > Drew Marsh schrieb: > > > > There seems to be no 'currentfocus' element in a page, and I'm a bit > > > stumped how to get the current focus of my app/page. > > > Probably I'm missing something very obvious here ![]() > > > Can someone help? > > > > Check out the static FocusManager::FocusedElement[1] property. > > I tried FocusManager.GetFocusedElement(), but it always returns null in > my case ![]() > > I'll dig around the FocusManager some more tomorrow though, thanks. > > Sam I`d be interested in knowing about your findings on your FocusManager digging... In the mean-time, I did work around that "problem" by using the Keyboard.FocusedElement property.. This solution is however far from perfect since the KeyboardFocus "drops" when application becomes inactive (keyboard focus in another application)... |
| | #5 (permalink) |
| Guest | Re: how to get focused item in a page Marcus schrieb: > Sam Jost wrote: > > Drew Marsh schrieb: > > > > > > There seems to be no 'currentfocus' element in a page, and I'm a bit > > > > stumped how to get the current focus of my app/page. > > > > Probably I'm missing something very obvious here ![]() > > > > Can someone help? > > > > > > Check out the static FocusManager::FocusedElement[1] property. > > > > I tried FocusManager.GetFocusedElement(), but it always returns null in > > my case ![]() > > > > I'll dig around the FocusManager some more tomorrow though, thanks. > > > > Sam > > I`d be interested in knowing about your findings on your FocusManager > digging... > > In the mean-time, I did work around that "problem" by using the > Keyboard.FocusedElement property.. Well, I didn't even start digging, since your post does contain my answer: I was looking for the keyboard focus, thats exactly the one I needed. > This solution is however far from perfect since the KeyboardFocus > "drops" when application becomes inactive (keyboard focus in another > application)... *scratches head* I got to check this, maybe I'll run into the same problems. Thanks, Sam |
| | #6 (permalink) |
| Guest | Re: how to get focused item in a page Hi, just thinking about the keyboard focus problem. Your app must be (at least one time) active - then you will get the KF Element. When another app gains the focus you will have no KF element - am I right? Idea: track the KF element in the manner of "CurrentKeyBoardFocusElement". When your app loses focus this element still points to the control which was focused before. So this should be the element you are looking for - no matter if you are active or not. Regards Manfred |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| page disappears when Mouse moved off page | CDNHart | General Discussion | 10 | 07-31-2008 05:02 PM |
| Blue Screen - Page fault in non page area | Gregstagg985 | Vista performance & maintenance | 0 | 07-22-2008 04:31 PM |
| Focused Control loosing focus | Ronaldo Moreira | Vista General | 0 | 04-04-2007 09:54 AM |
| How to Compose a Page From Grids Defined Outide the Page? | Chris Moore | Avalon | 10 | 11-11-2006 12:24 PM |
| Longhorn Server focused NG now up | Andre Da Costa [Extended64] | Vista General | 2 | 06-08-2006 07:58 PM |