Re: Control thumbnails
How about using the FluidLayout behavior from Blend? http://msdn.microsoft.com/en-us/library/ee341455(Expression.30).aspx First setup the Grid with the 4x4 rows/cols. http://msdn.microsoft.com/en-us/library/ee341455(Expression.30).aspxThen create two visual states: The first state will be your Grid with the child items arranged (by the sounds of it) in some sort of stacking layout. The second state will be your Grid with the child items arranged, with each item in one of the 16 grid cells. Then when you switch Visual State the layout will change. Activate the FluidLayout by clicking the little wave icon in the States window, and set the default transition to 1sec - if previews are enabled, as you toggle between visual states you should get smooth animated transitions. Note: If you are literally adding/removing items from the panel you will need to make sure that the items defined in the visual state are permanent i.e. you may need to place each child control into a container such that it is always present in the Grid. Do you already animate the push? Cheers, Jack On Mon, Dec 6, 2010 at 4:43 PM, Greg Keogh g...@mira.net wrote: This question is related to Silverlight and WPF, as I may need to use this technique in both sorts of apps. My app’s main Grid parent control can contain different types of child controls that display data in various ways. I internally maintain a 16-deep List of the children, I push a new child onto the top and make it visible, the others are pushed down and hidden and the oldest one drops off the end when it’s full. So I effectively have an MRU list of up to 16 child controls available. When the user hits a hotkey I want make all of the children visible and tile them in a nice 4 x 4 arrangement as thumbnails. I’m just not sure what the best mechanism is to achieve this. At first I thought I’d do it manually: centre-position and scale transform each child to create a fake tiled arrangement and maintain it on size changes. Before I do this manual coding, I thought I’d ask for ideas about better techniques. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Control thumbnails
Shane is a mind-reader. I was looking for the control that auto-sizes its contents in various ways, it's the ViewBox of course. I'll wrap each child in a ViewBox. My parent Grid can have 4 x 4 cells, and in normal display the top visible control will have row and col span 4 with Stretch=None. In tiled mode I'll show all children in a specific cell with Stretch=Uniform. Half an hour later: My experiments show it's starting to work, but there are some strange sizing behaviours like the Viewbox isn't filling the Grid. I'll look at it in the morning with a fresh mind. ADDENDUM: Jack, I received your message just before sending. 'Fluid Layout' is something I'd forgotten about completely. I'd rather go to the dentist than use Blend, but I'll try to figure out what it's doing behind the scenes and see if I can steal the code for a snazzy transition. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Control thumbnails
Hey, one more crack like that about Blend and I'll withdraw all suggestions! :-) -Original Message- From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh Sent: Monday, 6 December 2010 10:32 PM To: 'ozSilverlight' Subject: RE: Control thumbnails Shane is a mind-reader. I was looking for the control that auto-sizes its contents in various ways, it's the ViewBox of course. I'll wrap each child in a ViewBox. My parent Grid can have 4 x 4 cells, and in normal display the top visible control will have row and col span 4 with Stretch=None. In tiled mode I'll show all children in a specific cell with Stretch=Uniform. Half an hour later: My experiments show it's starting to work, but there are some strange sizing behaviours like the Viewbox isn't filling the Grid. I'll look at it in the morning with a fresh mind. ADDENDUM: Jack, I received your message just before sending. 'Fluid Layout' is something I'd forgotten about completely. I'd rather go to the dentist than use Blend, but I'll try to figure out what it's doing behind the scenes and see if I can steal the code for a snazzy transition. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: Control thumbnails
+1 hehehe On Mon, Dec 6, 2010 at 10:43 PM, Shane Morris (Automatic Studio) sh...@automaticstudio.com.au wrote: Hey, one more crack like that about Blend and I'll withdraw all suggestions! :-) -Original Message- From: ozsilverlight-boun...@ozsilverlight.com [mailto: ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh Sent: Monday, 6 December 2010 10:32 PM To: 'ozSilverlight' Subject: RE: Control thumbnails Shane is a mind-reader. I was looking for the control that auto-sizes its contents in various ways, it's the ViewBox of course. I'll wrap each child in a ViewBox. My parent Grid can have 4 x 4 cells, and in normal display the top visible control will have row and col span 4 with Stretch=None. In tiled mode I'll show all children in a specific cell with Stretch=Uniform. Half an hour later: My experiments show it's starting to work, but there are some strange sizing behaviours like the Viewbox isn't filling the Grid. I'll look at it in the morning with a fresh mind. ADDENDUM: Jack, I received your message just before sending. 'Fluid Layout' is something I'd forgotten about completely. I'd rather go to the dentist than use Blend, but I'll try to figure out what it's doing behind the scenes and see if I can steal the code for a snazzy transition. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight -- Miguel A. Madero Reyes www.miguelmadero.com (blog) m...@miguelmadero.com ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Control thumbnails
I have found that it is unreliable to use a Viewbox unless you specifically want the effects it produces. I planned to fill the parent Grid with a Viewbox Stretch=None to effectively turn it off, but there are weird side-effects. Viewbox has a mind of its own about sizing inside a parent. I cannot get a Viewbox to reliably fill a parent Grid. I will therefore have to dynamically rearrange the child controls to place them inside Viewbox inside different Grid cells to get my tiled effect. This is possible, but it's a lot of loops and code and jugging controls around to different parents. I'll think about it... Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight