Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Set XamTilesControl.ItemTemplateMinimized in a view added to the tiles collection.
posted

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

 

  • 4850
    Suggested Answer
    Offline posted

    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.