I am trying to achieve something similar to iPhone message view. On a button click, a delete button would slide out for every message and on clicking \"done\" the delete buttons
Old question... huh...
Anyway... forget about visibility. The trick is to animate Width/Height
of the Control placed in Grid's Column/Row
where the Column/Row
has Width set to Auto. Uff :)
So here is a Grid
named "container" with two columns. In the first column can be placed whatever you want, but you should align it to Right since you want it to move when your delete button is displayed. And in the second column there is a Control (representing your DeleteButton) Notice that first column has Width="*"
and second column has Width="Auto"
And the Control
in Grid's second column has DataTrigger
based on your ViewModel's property "ShowDeleteButton"
Since the Width
of column where the Control
is placed is Auto
you can change the width of the Control
using simple DoubleAnimation
and you get desired behavior.
EDIT
Look at this if you want the flyout to be over everything else.
Please note that button "Out" can be clicked while it's moving. It should be probably disabled. I just did it like this because I wanted to do it simple and all in xaml. Sure you can use mahapps. Or you can just make it as fast as it is in MahApps and it's impossible to click it twice. :) I have looked at MahApps FlyOutDemo and my solution looks much simpler to me. And I don't need third party library.