Off top of head, you could do it the same way you showed below without a
converter by binding to an opacity property. The binded class would have
two properties that represented the two states.
Also, if you do use the converter approach, you could once again push the
responsibility back to the class you are binding to and have two properties
ShowChecked, ShowUnchecked. And then you just need one converter.
Unless you are worried about the amount of xaml to keep xap small,
personaly I like the style / template approach. You probably know this,
but just in case, go into blend, add a toggle button to a screen, right
click on the button -> edit template -> edit a copy. Then go to the
xaml view, grab the style it created and stick it in your project. Then
you need to hack in your images into the grid that is the button. All you
need to do then is find the visual state groups for checked / unchecked and add
in something to hide/show the right image.
Once you do this a few times it is pretty easy. 99% of the xaml is
already generated for you.
On Fri, 19 Mar 2010 10:44:46 +0530 wrote
>Getting late on a Friday and the client asked if the togglebuttons (which
have icons as content) could change to a different icon whentoggled.Thought of
3 ways to do it:1.Override the template, have two images, set opacity inthe
visual state storyboard Checked/UnChecked. Tonnes of XAML...2.Create a custom
control ContentToggleButton that takestwo sets of content, one for Check, one
for Unchecked, switch them on statechange. Tonnes of Time...3.(Assuming your
binding) Add two images to thetogglebutton and bind their visibility to the
same property using avisibilityConverter and of course a quickly hacked up
Inverted converter!<ToggleButtonImage>
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight