asp.net - Style a XAML button control with C# -


i have xaml button control looks so:

<button x:name="my-button" grid.row="3" content="see more foo" click="my-button_click" style="{staticresource bluebuttonstyle}" width="75" height="23" horizontalalignment="right" margin="10,20,90,0" /> 

i'd change style of button in c# method along lines of:

public void changebuttoncolor() {     //change style attribute of my-button redbuttonstyle } 

how go accessing xaml control in c# code behind?

this in silverlight 4.0 application.

not complete solution, found workaround helped me, thought share. objective of changing style of button disable it. so, instead of changing style, set isenabled attribute of xaml control "false".

using c#, able change isenabled attribute definition accessing control directly via:

public void enablebutton() {     my-button.isenabled = true; } 

though looks styles have been affected through configuration of visualstatemanager, did not end having go far.

thanks @chris w. discussion thread , helping me here!


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -