I want change background image on every FlipView item.
I'm try this code, but it fired error Only IBehavior types are supported in a BehaviorCollection.
How set image source correctly?
<Grid>
<i:Interaction.Behaviors>
<core:DataTriggerBehavior
Binding="{Binding SelectedIndex, ElementName=TourFlipView}"
ComparisonCondition="Equal"
Value="1" />
<core:ChangePropertyAction
TargetObject="{Binding ElementName=TourFlipViewBackgroundImage}"
PropertyName="Source"
Value="ms-appx:///Assets/Images/2.png" />
</i:Interaction.Behaviors>
<Image
x:Name="TourFlipViewBackgroundImage"
Source="ms-appx:///Assets/Images/1.png" />
<FlipView
x:Name="TourFlipView">
...
<FlipView/>
</Grid>
答案 0 :(得分:4)
You did almost correct with small mistake. put your ChangePropertyAction
inside DataTriggerBehavior
<i:Interaction.Behaviors>
<core:DataTriggerBehavior
Binding="{Binding SelectedIndex, ElementName=TourFlipView}"
ComparisonCondition="Equal"
Value="1" >
<core:ChangePropertyAction
TargetObject="{Binding ElementName=TourFlipViewBackgroundImage}"
PropertyName="Source"
Value="ms-appx:///Assets/Images/2.png" />
</core:DataTriggerBehavior>
</i:Interaction.Behaviors>