I have tiles with content that expands vertically (grids that add rows) so I found this thread (http://blogs.infragistics.com/forums/t/46088.aspx) and tried the solution, TilesPanel.InvalidMeasure() and it works, yet not for all cases.
If a tile has been manually resized, or a layout loaded with a PreferredWidthOverride and PreferredHeightOverride for each tile, then those tiles will not respond to content size changes even when using the TilesPanel.InvalidMeasure() workaround. Oh, and if the VerticalTileAreaAlignment is set to Stretch it won't work either.
I tried setting the preferred height Constraints for individual tiles, hoping it would override whatever the TilesPanel is calculating - no luck. The only way I could accomplish this was to set the min height Constraint for each tile as it expanded or contracted.
This is an awful workaround as it requires a lot of code behind, can someone please help me with a better solution. It can be easily reproduced using the XamTileDemo posted in the link above. Manually resize the Beverages tile before pressing Add Beverages.
This is version 10.3, I'm going to try 11 next week.
Hello Chris,
I can see the issue you are describing, however when you resize the tile, you manually set its height to a fixed size. Further when you add the new elements, the tile already has a fixed size, so arrange its content in it without further resizing. If you use the ListView alone in the template of the tile when you add the elements (even when the tile is manually resized) a scrollbar will pop. In case in the template you wrap the content with StackPanel no scrollbar will indicate the adding of the new content, because the scrollbar supports logical not physical scrolling. This is why I suggest you after resizing you manually set the desired height of the contained control based on the available space in the TilePane or use control which will give the content physical scroll functionality, so all of your elements will be accessible.
If you have any further questions or concerns about this, please feel free to ask.
Thanks Elena,
I have already discovered this solution, yet it is not a very good solution. Consider a tile that contains a grid that expands/contracts with items in collection bound in a ViewModel (VM). Usually to make the grid expand/collapse it takes little more than adding an item to the collection in the VM, no code behind. Now I have to create all this code behind to calculate the minimum size and set it.
Even worse, if my collection is data templated, and the templates can be reused for more than just tiles, it creates a lot of extra code which becomes a maintenance nightmare.
This still doesn't solve the problem of allowing the user to manually resize tiles.
Thus I've recommended not using Horizontal/VerticalTileAreaAlignment=Stretch for our project as it creates more problems than it solves.
Cheers, Chris
Hello taylor192,
I was looking into your issue and I can suggest you manually change the MinHeight property of the tile after adding the new elements. For example in the sample from the forum post you can add in the button click event
Tile tile1 = this.xamTilesControl1.TileFromItem(this.xamTilesControl1.Items[0]);
tile1.MinHeight = 400 + tile1.ActualHeight;
If this doesn’t suit your scenario or you have any further questions on the matter, please do not hesitate to ask.