Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear all,

i am working on a project on the micrsoft surface table
but i am stuck with something i can't solve

i am using a template to change the form of my button
but i would also want to change the button into another form
when an event occurs(in c# or xaml) or more specifically when i press the button the second time

can someone help me?

Nico
Posted

Do you want it to just change, or to animate ? I create irregular shaped windows and buttons by creating transparent controls and drawing the outline I want on them. The only issue is, I've never found a way to animate from one outline to another.
 
Share this answer
 
Don't push 'answer' to ask questions, comment on my reply, or edit your post.

If you just want it to change, you will have to do it in code, the button has no templatable state for 'the second time it was pushed', you can create a template for states like mousedown, though.
 
Share this answer
 
Comments
Nicotjai 2-Jul-10 6:45am    
sorry im on my telephone right now...
But i know i cant use 'the second time' to change the button's shape
but i thought to change the template the button is using to another template in code
but i don't know if thats possible
For changing the template at runtime take a look at this should be fairly similar to what you want:
http://codingbandit.com/Blog/blog/wpf-data-templates-part-3-switching-data-templates-at-runtime/[^]

You could easily then detect the second press of the button with a counter and then trigger the template change like the above.

Styles work in basically the same way I have two styles declared in the Window.Resources section of my window that look like this:
<Style x:Key="rField" TargetType="{x:Type Label}">...</Style><br /><br />
<Style x:Key="Field" TargetType="{x:Type Label}">...</Style><br />


And some code-behind like this (mine happens to be in VB - though converting to C# shouldn't be too hard):
<br />
lblPhone.Style = CType(Me.Resources("rField"), Style)<br /><br />
lblPhone.Style = CType(Me.Resources("Field"), Style)<br />


Hope that helps.
 
Share this answer
 
i want to change it
i was wondering if i could let the templatebinding takeover another
 
Share this answer
 
Comments
Toli Cuturicu 2-Jul-10 15:03pm    
Reason for my vote of 1
fake answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900