It is consistent (I assume you are referring to the fact that the Border doesn't handle the events). Here is why:
The Border is a different element in the TextBox's tree. It doesn't take any action when you hit it with a mouse. It does not handle the input, thus it doesn't mark the event as handled, so that others can handle it further up the chain. The input area of
the TextBox does take an action when you hit it with a mouse. It does handle the input, thus it marks the event as handled.
Aside from being consistent, this is also compatible with WPF, which has been using the same design and has had the same consistent behavior for years.
I'm new to Silverlight, using the RC of Silverlight4. If I create TextBox2 as StefanWick has shown (inheriting from TextBox), then put TextBox2 in my XAML, I get error "The Type TextBox2 was not found". Do I have to register it or something, or put the
code in a user control??
What about SL4? Any changes to MouseLeftButtonDown or MouseRightButtonDown? I think I read that they added some right-click context? Since the XAML syntax acknowledes MouseRightButtonDown, how is it implemented?
MouseLeftButtonDown works great for me on a TextBlock. I also implemented MouseRightButtonDown in the same manner, but when I try right-click (in the browser), all I see is a small pop-up box that says "Silverlight" when I try it.
In my training app, I want to show some text while the user holds down the mouse button, ideally over a textbook, and then show alternate text while he holds down the right mouse button.
I know this post is very old ... but I am experiencing this same problem where I can't type into the Textbox.
When I run from Visual Studio, the Textboxes work without a problem. When I deploy onto my test system the Textboxes are "locked" and I cannot type into any of them.
I am not changing the visibilty attribute. I just removed the validation, just to see if that mattered. It did not.
StefanWick
Contributor
3004 Points
453 Posts
Microsoft
Re: RC0 Error: TextBox is locked and does not fire event
Oct 02, 2008 05:54 AM | LINK
It is consistent (I assume you are referring to the fact that the Border doesn't handle the events). Here is why:
The Border is a different element in the TextBox's tree. It doesn't take any action when you hit it with a mouse. It does not handle the input, thus it doesn't mark the event as handled, so that others can handle it further up the chain. The input area of the TextBox does take an action when you hit it with a mouse. It does handle the input, thus it marks the event as handled.
Aside from being consistent, this is also compatible with WPF, which has been using the same design and has had the same consistent behavior for years.
Thanks, Stefan Wick
mr.saif
Member
438 Points
166 Posts
Re: RC0 Error: TextBox is locked and does not fire event
Oct 18, 2008 12:09 PM | LINK
But this breaks things for my project.....:(
Muhammad Saifullah
StefanWick
Contributor
3004 Points
453 Posts
Microsoft
Re: RC0 Error: TextBox is locked and does not fire event
Oct 18, 2008 03:16 PM | LINK
Can you explain the scenario that this breaks? Does deriving your own class from TextBox not un-break it for you?
Thanks, Stefan Wick
Neal Walters
Member
8 Points
30 Posts
Re: Re: RC0 Error: TextBox is locked and does not fire event
Apr 04, 2010 05:23 PM | LINK
I'm new to Silverlight, using the RC of Silverlight4. If I create TextBox2 as StefanWick has shown (inheriting from TextBox), then put TextBox2 in my XAML, I get error "The Type TextBox2 was not found". Do I have to register it or something, or put the code in a user control??
What about SL4? Any changes to MouseLeftButtonDown or MouseRightButtonDown? I think I read that they added some right-click context? Since the XAML syntax acknowledes MouseRightButtonDown, how is it implemented?
MouseLeftButtonDown works great for me on a TextBlock. I also implemented MouseRightButtonDown in the same manner, but when I try right-click (in the browser), all I see is a small pop-up box that says "Silverlight" when I try it.
In my training app, I want to show some text while the user holds down the mouse button, ideally over a textbook, and then show alternate text while he holds down the right mouse button.
Thanks,
Neal Walters
MouseLeftButtonDown MouseRightButtonDown
dbaechtel
Member
70 Points
221 Posts
Re: Re: RC0 Error: TextBox is locked and does not fire event
Apr 05, 2010 10:35 PM | LINK
I don't think that the original question was saying anything about the border. The question was about the Textbox.
DeborahK
Member
183 Points
204 Posts
Re: RC0 Error: TextBox is locked and does not fire MouseLeftButtonDown event
Feb 03, 2011 09:26 PM | LINK
I know this post is very old ... but I am experiencing this same problem where I can't type into the Textbox.
When I run from Visual Studio, the Textboxes work without a problem. When I deploy onto my test system the Textboxes are "locked" and I cannot type into any of them.
I am not changing the visibilty attribute. I just removed the validation, just to see if that mattered. It did not.
Not sure how to fix this?