Page view counter
Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back
Last post 06-17-2008 9:45 PM by johnpapa. 9 replies.
Sort Posts:
06-17-2008 3:41 PM
Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back
I have a textbox on a usercontrol, with no styles. It has its Text property == “Hello”. When the control first loads, I can click in it and type, but I do not see the cursor. I have to minimize the entire IE window then come back before I can see the cursor in the textbox. At first I just ignored this. But then I noticed that TwoWay binding was not working for me due to this. For example, the textbox is bound TwoWay to an entity … the value also shows up in a TextBlock. When I type in the TextBox (when it first loads and I cannot see the cursor) the value is not updated in the TextBlock. However, if I minimize the IE instance and go back to it, everything works great. Has anyone ever seen anything like this in Silverlight 2 Beta 2?

Here is my sample code. When I first run this I cannot select the text til I go off the window and back (switch windows). Note that the problem occurs if you browse to the page with the silverlight control on it. However if you run the app in VS the problem does not happen.

<UserControl x:Class="TextBoxTester.Page"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="300">

<Grid x:Name="LayoutRoot" Background="White">

<TextBox x:Name="tbMsg" Text="Hello World" Height="30" Width="Auto"></TextBox>

</Grid>

</UserControl>

 

johnpapa

Loading...
Joined on 05-05-2008
Posts 9
06-17-2008 4:13 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

 Are you using IE7? I just tested on IE7 and Firefox, both worked fine without the problem you described.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,691
06-17-2008 4:13 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

I just saw that there is another post in the forums on this same issue.

http://silverlight.net/forums/t/12865.aspx

 

 

johnpapa

Loading...
Joined on 05-05-2008
Posts 9
06-17-2008 4:20 PM
Re: Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

 It doesn't do it for me, but my boss has the issue on his computer.

Jhorra

Loading...
Joined on 08-29-2004
Phoenix, Az
Posts 420
06-17-2008 4:27 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

I found out more information on this.

(Oh, and yes I am using IE 7. )

It works fine if I right click in Visual Studio and browse to the page (or from Blend). I imagine it will work any tim eyou open a new browser window. However, it does NOT work if I refresh the page in the browser window. So try hitting refresh in the brwoser and see if it works.

johnpapa

Loading...
Joined on 05-05-2008
Posts 9
06-17-2008 4:28 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

In beta 1, I have seen this message when I first load the Silverlight HTML page: "click to activate and use this control silverlight control". Which means the Silverlight control is not active until you first click on the page or press space bar.  Do you see this message?  I had a workaround in the html page to get rid of it in beta 1 and it only happened on the html page not on the aspx page.

But since beta2, I haven't seen this problem again. Maybe I had some latest patch for IE fixed that.  Because that was not Silverlight specific problem. It was a problem for all the object tags in IE. I'm not sure if you are having this problem or not.

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,691
06-17-2008 4:36 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

No, I do not get that message. The page simply appears and you cannot see the cursor in the textbox nor select anything in it til you move out of the silverlight control and back in.

johnpapa

Loading...
Joined on 05-05-2008
Posts 9
06-17-2008 5:16 PM
Marked as Answer
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

There is a bug about this that will be fixed after Beta 2. I'm not sure of all the circumstances for when it occurs, but usually (not always) it occurs if the TextBox is the first control to receive focus when you start your app. If it is the second control and you tab to it or click in it then it usually works.

-mark
Silverlight Program Manager
Microsoft
This post is provided "as-is"

Mark Rideout

Loading...
Joined on 01-03-2006
Redmond, WA
Posts 266
06-17-2008 5:22 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

I used refresh button, still works.

I also tested on several machines, one with IE6 and other one with IE7 without the latest patch. On those two machines I see "Click to activate this control" message. But when I clicked on the Textbox, that message went away. The Textbox immediately got the focus and cursor was shown on the box.


 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,691
06-17-2008 9:45 PM
Re: Odd Control Behavior or Bug - TextBox does not show cursor unless entire Silverlight 2 control loses focus and comes back

Mark ... thanks. Good to know.

I just have to find a stable workaround for my app for now.

johnpapa

Loading...
Joined on 05-05-2008
Posts 9
Microsoft Communities