の背景に画像を結合私持っている私のXAMLで、次のコード:トグルボタンEventTriggerBehavior-トグルボタン
<ToggleButton x:Name="play" Command="{Binding OnPlayButton}" CommandParameter="{Binding ElementName=media , Mode=TwoWay}" HorizontalAlignment="Left" Margin="573,638,0,0" VerticalAlignment="Top" Height="50" Width="50">
<Image Name="MyImage" Source="Images/Control/Play.png"/>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Checked">
<core:ChangePropertyAction PropertyName="MyImage" Value="{Binding Source=Images/Control/Pause.png}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="Unchecked">
<core:ChangePropertyAction PropertyName="MyImage" Value="{Binding Source=Images/Control/Play.png}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ToggleButton>
何私はpause.pngするトグルボタンの背景を変更されて達成しようとしているときにクリックし、もう一度クリックするとplay.pngに変わります。 xamlで例外が発生していますが、これは正しい方法ですか?
こんにちは、これは正しい解決策です。 –