Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello to all
i want change style my button when i click on the button
example:
-------------------------------------------
C#
bool k=false;
private void button1_Click()
{
  if(k)
  {
    button1.style=style1;
    k=false;
  }
  else
  {
    button1.style=style1;
    k=true;
  }
}

-------------------------------------------
Thanks
Posted
Updated 27-Oct-12 9:10am
v2
Comments
Sandeep Mewara 27-Oct-12 15:11pm    
And the issue is? For WPF, read on behaviours, triggers, ControlTemplate.
Clifford Nelson 29-Oct-12 19:46pm    
You are setting the button style to the same style in both parts of the if statement, so maybe that is your problem

tanks ridoy
------------------------------
but i have two Style in MyProject.
I dont change background my button. i created and Design my styles (Style1 and Style2) By BLEND
i want change style my button when user pressed button (set style1) AND when Repeted(set Style2 only this not more).
------------------------------
code button:
Private void Butto1_Click()
{
This.TopMost = !((bool)this.TopMost);
/***** when Form1.TopMost=True set Style1 (and Save) *****/
/***** And when Form1.TopMost=False set Style2 (and Save) ******/
}
------------------------------
very tanks.
 
Share this 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