Can you tell a control to "lose" focus?
Last post 05-16-2008 4:52 AM by coughlinj. 4 replies.
Sort Posts:
05-10-2008 8:08 AM
Can you tell a control to "lose" focus?

I want a control to lose focus but don't have a specific place to put focus.  Is there some way to do this?

 

Currently I'm hacking it by creating a button that has an opacity and size of 0.  I set the focus to this invisible button.  But this seems like a total hack.

 


The scenario I'm trying to cover here is the user enters some kind of cellEditor.  They submit their changes by pressing enter.  The cellEditor needs to lose focus but nothing else should assume focus.

 

Thanks for the help, 

Justin 

coughlinj

Joined on 03-07-2008
Vancouver
Posts 43
05-12-2008 2:45 AM
Re: Can you tell a control to "lose" focus?

You can place focus on the SL control using the HTML integration.

(If this has answered your question, please "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 2 Workshop
May 12-14, 2008 - Atlanta, GA
May 28-30, 2008 - San Francisco, CA
http://www.silverlight-tour.com

swildermuth

Joined on 10-13-2003
Atlanta, GA
Posts 1,058
05-12-2008 3:49 AM
Re: Can you tell a control to "lose" focus?

If possible could you provide a link for reference or a bit more details regarding the HTML Integration. I will try to hunt it down on my own tomorrow but if you have an example or a reference that will help out.

Thanks for the suggestion. 

Justin 

coughlinj

Joined on 03-07-2008
Vancouver
Posts 43
05-16-2008 2:20 AM
Re: Can you tell a control to "lose" focus?

Hi:

coughlinj:

Currently I'm hacking it by creating a button that has an opacity and size of 0.  I set the focus to this invisible button.  But this seems like a total hack.

  I think there's no other option in current version. We have to focus another control to get a blur effect.

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Allen Chen – MSFT

Joined on 03-16-2007
Posts 717
05-16-2008 4:52 AM
Re: Can you tell a control to "lose" focus?

 Thanks Allen,

 That's the approach I'm using now but its really hacky and doesn't work all that well.  I'm running into problems with the popup which may be related.  Anyways I'm off for the next few weeks but thanks for all your help.

 

Justin
 

coughlinj

Joined on 03-07-2008
Vancouver
Posts 43