I have attached a TranslateZoomRotateBehavior to a Grid:
<Grid>
<!--all sorts of content-->
<Button Content="Cancel" Click="CancelButton_Click Width="25" Height="20"/>
<i:Interaction.Behaviors>
<ei:TranslateZoomRotateBehavior ConstrainToParentBounds="True" SupportedGestures="Translate"/>
</i:Interaction.Behaviors>
</Grid>
in the CancelButton_Click eventhandler I want to reset the TranslateZoomRotateBehavior to return the Grid and it's content to it's original position. Does anyone know whether this is possible?
If you name the grid that you want to reset the behaviours collection on.
<Grid x:Name="grid1">
You can get a list of the behaviors in code behind with
var b = System.Windows.Interactivity.Interaction.GetBehaviors(grid1)
You're then free to work with them however you want, if you want to remove them all .Clear() if you want to reset just values but keep the TranslateZoomRotateBehavior you can access it with
TranslateZoomRotateBehavior targetBehavior = (TranslateZoomRotateBehavior)b[0];
targetBehavior.ConstrainToParentBounds = true;
targetBehavior.SupportedGestures = ....