locked
GridView ignores GroupStyle.ContainerStyle RRS feed

  • Question

  • I've been trying to add a Margin around my groups in a GridView so one group doesn't run into the next.  I figured the best way to do this was by editing the GroupStyle's ContainerStyle.  So, I added a Margin of 20 and didn't see any difference.  I added a Background color and a visible Border and don't see any visual changes in the UI at all.

    <GroupStyle.ContainerStyle>
    	<Style TargetType="GroupItem">
    		<Setter Property="BorderBrush" Value="LightGray" />
    		<Setter Property="BorderThickness" Value="10" />
    		<Setter Property="Margin" Value="20" />
    	</Style>
    </GroupStyle.ContainerStyle>
    

    I attempted a similar exercise using the XAML GridView Grouping example project and had the same experience -- no matter what I do to the GroupStyle.ContainerStyle of the GridView, nothing seems to change visually in the UI.

    I anyone else experiencing similar issues?

    Saturday, January 18, 2014 6:32 AM

All replies

  • Hi jasonxz2,

    Are you working with Win8.1 apps? Currently ContainerStyle property is not supported by windows 8.1, use GroupItem instead.

    If you are working with 8.0 app, should works fine.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, January 20, 2014 9:26 AM
    Moderator
  • I really appreciate the help Jamles, but unfortunately, I can't seem to find any examples of altering the GroupItem style for a GridView or ListView.  Even the MSDN GridView sample project I downloaded doesn't contain the text "GroupItem" in any included XAML files. I DID manage to find the default "GroupItem" style and know how I would alter it, but have not figured out how to apply the altered style to the specific GridView or ListView.

    If you could, please, point me to a working example of how to customize the "GroupItem" style for a GridView, I would really appreciate it.

    Tuesday, January 21, 2014 4:46 AM
  • Hey James!

    Are there any examples on how to do this in 8.1?  The link to the GroupItem class that you provided is for 8.0 and doesn't provide any examples of how to use it, anyway.

    I can't seem to find any documentation on this other than the mention that the ContainerStyle isn't supported anymore.

    Tuesday, January 28, 2014 3:26 PM