What's the shortest xamly way to make a ToggleButton
contents depend on its checked state?
In WPF I'd probably go for a DataTrigger
which doesn't exist in Silverlight.
I tried the following, but it doesn't work, as soon as I include the triggers, the binding to the source is broken. The triggers won't work anyway.
<ToggleButton
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
IsChecked="{Binding IsArchived, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Checked">
<ei:ChangePropertyAction
TargetObject="{Binding
RelativeSource={RelativeSource AncestorType=ToggleButton}}"
PropertyName="Content" Value="Unarchive project"/>
</i:EventTrigger>
<i:EventTrigger EventName="Unchecked">
<ei:ChangePropertyAction
TargetObject="{Binding
RelativeSource={RelativeSource AncestorType=ToggleButton}}"
PropertyName="Content" Value="Archive project"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ToggleButton>