Skip to main content
Home Forums Silverlight Design Designing with Silverlight Behavior of simple elements (TextBlock, Rectangle...)
6 replies. Latest Post by e-statik on August 26, 2008.
(0)
e-statik
Member
0 points
11 Posts
08-22-2008 1:10 AM |
I can't figure out, how to make TextBlock changing its style on mouseover event for example.
Its easy for the button, because it already has some necessary states, such as "MouseOver", "Pressed"... I can create states for the texblock or Rectangle, bu how can i link them to events or activate them?
Thanks!
HarshBar...
Star
9908 points
1,719 Posts
08-22-2008 1:16 AM |
For every silverlight Control There are Some event like MouseEnter(similar to MouseOver),MouseLeave(similar to mouse out),MouseLeftButtonDown etc.You Can change Style In these Events and You can use that .
Mark it as answer if it answers your Question..
08-22-2008 1:36 AM |
You mean, i should change style programmatically in codebehind file? Yes, i know that and I think its wrong way. I'm using styles, placed in resources and hardcoding style names or color values (for example) in code is bad solution.
Allen Ch...
13862 points
1,803 Posts
08-25-2008 5:18 AM |
Hi
Currently style can only be set once. If you want to change the style you have to change each property separately. Please post your current code if you have further questions.
08-25-2008 7:35 AM |
But i dont want to change style. I just wanna know how to change states of my TextBlock, like i can do with Button, for example.
Mark Rid...
Contributor
2357 points
273 Posts
08-25-2008 9:19 PM |
Only elements that derive from Control support visual states and template. A TextBlock or an Image derives from FrameworkElement which does not support this.
-markSilverlight Program ManagerMicrosoftThis post is provided "as-is"
08-26-2008 3:45 AM |
Ok, thanks.