This project is read-only.

CustomGridSplitter animation

Jan 17, 2014 at 5:28 PM
CustomGridSplitter is fantastic! Love it.
Now, I am asking for something that may be too much, but let me do it in case there is a way.
How can the movement of CustomGridSplitter be animated?
I am asking this because animating a column width of Grid seems to be impossible or quite a hassle for a Windows Store app.

I tried TranslateTransform on property X, but the result is messing up the splitter completely.

Jan 17, 2014 at 7:15 PM
That's interesting and I think I even wanted to do something like that built in, but never got there.
I don't have the time to do it now either, but essentially - the control has a ShowsPreview property, which is false by default.
I would switch it to true and modify the code in PreviewGridSplitter_DraggingCompleted to first call "_parentGrid.Children.Remove(_previewPopupHostGrid);", then run the RenderTransform animation on "this" grid splitter to show it moving to a new position, then reset the RenderTransform and only then update the grid rows/columns with the "_parentGrid.RowDefinitions[i].Height" call.
Jan 17, 2014 at 8:46 PM
Thank you for the tip. It is going to take a bit time for me to digest your tip. Right now, the splitter moves smoothly. The movement couldn't be any better, but the splitter loses its function completely after the animation and the splitted column will never be changed by the splitter after the animation. I want to show widths changing in response to the animation.
Jan 17, 2014 at 8:55 PM
Not sure what you're doing without seeing the change. Animating widths is a bad idea since those are dependent properties and so each change causes layout updates within the columns.
Jan 17, 2014 at 9:29 PM
That is a very good point. I am using a timer to realize the animation now. It is not nearly as smooth as what StoryBoard usually achieves. Even I succeed in tweaking CustomGridSplitter to make the animation, it may not be any better than what I have now due to the inherent inefficiency of changing column widths. I think I will bear with what I have now.