This project is read-only.

Futureproof? Animate grid cell to contents?

Jan 22, 2013 at 9:16 AM

Hi, I've worked with most of Microsoft's tools since VB3 and just learning WinRT now. One problem I've had in the past is with 3rd party controls, like the good old Sheridan controls for VB4 I think it was - Allowed apps to look more appealing, but it was a maintenance time-bomb as Microsoft then added most of them to VB5 or during updates, and the Sheridan controls went obsolete. Nothing like that will ever happen with the XAML Toolkit, will it?

I have the toolkit working which is great - and I've found that I can add a vb project to the solution and access the same components which is fine. 

I'm looking at the CustomGridSplitter and would like to enhance it so that I can animate the splitters, making the cells smoothly expand and collapse under control of the code - or possibly just depending on the space taken by the controls inside them.

As I'm just starting with this I think it's going to take some time even to work out what the approach should be - can anyone point me in the right direction with this?

Many thanks

Jan 22, 2013 at 9:32 AM

I don't know about VB3, but you have the entire source code here, so you can just grab it and change it as you wish. Right now I am trying to get rid of most bugs reported and I use it myself, but if I was ever to get too busy to continue it - I am sure there are many people who could easily continue that.

As for the GridSplitter - I would avoid messing with what's inside of it. I'm afraid to look inside myself after a while. :) For what you are saying you could maybe subclass it or add a custom behavior or simply do some code behind for what I think I understand you are saying. I would avoid animating the splitter and resizing the grid at the same time - this is most likely to be pretty choppy since layout animations run on UI thread, but you could animate a RenderTransform of the splitter to move it and at the animation's completion - revert the transform and resize the grid. Note that if you want to do that with code - you don't actually manipulate the splitter, but update the grid's row or column definitions. See here:

Jan 22, 2013 at 9:40 AM

Very helpful thanks. Yes, having the source will certainly help for maintenance.


Cheers, Ian

Jan 22, 2013 at 10:32 AM

Ok, I managed to animate the grid inside the 1st column, which is a step forward but not what's needed obviously as I need to animate the column containing that grid. But the width of a col is not a double, it's a gridlength, and there isn't a gridlength animation. What's the easiest way to deal with this?

Jan 25, 2013 at 8:30 AM

You can animate something else with a double-typed property (e.g. the Value property of an invisible Slider) and update grid dimensions on a change of that property. That of course doesn't seem very efficient but it might work depending on what you are trying to achieve.

What is in your column? Maybe you could use an independent animation somehow?