Getting late on a Friday and the client asked if the toggle buttons (which
have icons as content) could change to a different icon when toggled.
Thought of 3 ways to do it:
1. Override the template, have two images, set opacity in the visual
state storyboard Checked/UnChecked. Tonnes of XAML...
2. Create a custom control ContentToggleButton that takes two sets of
content, one for Check, one for Unchecked, switch them on state change.
Tonnes of Time...
3. (Assuming your binding) Add two images to the togglebutton and bind
their visibility to the same property using a visibilityConverter and of
course a quickly hacked up Inverted converter!
<ToggleButton Grid.Column="1" Style="{StaticResource ToggleButtonStyle}"
HorizontalAlignment="Left" DataContext="{Binding
BindsDirectlyToSource=True}" IsChecked="{Binding Path=Selected,
Mode=TwoWay}">
<Grid>
<Image Width="14"
Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Imag
es/eye_open.png" Visibility="{Binding Path=Selected,
Converter={StaticResource VisibilityConverter}, Mode=OneWay}" ></Image>
<Image Width="14"
Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Imag
es/eye_closed.png" Visibility="{Binding Path=Selected,
Converter={StaticResource InvVisibilityConverter}, Mode=OneWay}" ></Image>
</Grid>
</ToggleButton>
Is there a better way? I know everyone just talked about the dreaded
Visibility converter, is there an easy way to invert it without making a new
one?
John.
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight