I was wondering how I can add a minimized template to a view being added to a tiles collection. I am adding tiles to the control via code:
public void AddTile(DataQueryCollectionPresenter context) { xamTilesControl1.Items.Add(CreateTile(context)); }
private Tile CreateTile(DataQueryCollectionPresenter presenter) { Tile tile = new Tile { Header = presenter.Model.DataQueryInstance.Name, Content = presenter.View, SerializationId = presenter.Model.DataQueryInstance.DataQueryDefinition.Id.ToString() };
return tile; }
How can I set in the Xaml or otherwise, what the XamTilesControl.ItemTemplateMinimized for this view should be?
Setting it via Xaml on the tilescontrol itself doesn't seem to take when I add a view to the collection...
Hope this is clear?
Thanks,
David
Hi David,
There are ContentTemplate... properties exposed off the Tile for each of the 4 states:
ContentTemplate (for the Normal state), ContentTemplateMaximized, ContentTemplateMinimized and ContentTemplateMinizedExpanded.
The reason the XamtTabControl's ItemTemplateMinimized property is not being picked up is because you are adding Tiles to the Items collection. If you were adding any other type of item then a Tile container would be automatically generated and the ItemTemplateMinimized property would be used to set the container's ContentTemplateMinimized property.
This follows the pattern of other ItemsControl containers., e.g. if you added ListBoxItems directly to a ListBox's Items collection, the ItemTemplate property would not be applied.