Haider
Haider

Reputation: 461

Windows Store Apps- GridView Item width

I am trying to create a GridView with different width for each of its Items. I've declared all the items in my XAML ( i.e.they are predefined) and have given them different width sizes. But when the application runs all the items get equal width. What am I doing wrong here?

Upvotes: 0

Views: 749

Answers (1)

Dev
Dev

Reputation: 367

GridView uses VariableSizedWrapGrid panel to layout its children elements. There seem to be a bug that makes all items in the grid to be of same size as the first item. Check this thread on MSDN forums for details: VariableSizedWrapGrid / WrapGrid Strange Measuring

You will need to replace that panel with the one that actually supports variable sized elements.

Example:

     <GridView>
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
        ...
     </GridView>

Upvotes: 1

Related Questions