Welcome to the Xceed Community | Help
Community Search  
More Search Options

Hiding Grouped Rows

Sort Posts: Previous Next
  •  05-24-2012, 10:49 AM Post no. 32144

    Hiding Grouped Rows

    Hello, we're trying to style the XCeed WPF datagrid so it has a consistent look with the rest of our application and it was decided to try to hide the grouped rows in the Datagrid. Basically our user interface developer created a style that targets the type GroupHeaderControl which is what shows up when you group something. He created a converter:

    <Style TargetType="{x:Type xcdg:GroupHeaderControl}">

                <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Self}, Path=Group, Converter={StaticResource myVisibilityConverter}}" />

     That sets the visibility of the various GroupHeaders based on the IsBottomLevel property of the Xceed.Wpf.DataGrid.Group.

     class myVisibilityConverter : IValueConverter

        {

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

            {

                if (value == null)

                    return null;

                if ((value as Xceed.Wpf.DataGrid.Group) == null)

                    return null;

                if ((value as Xceed.Wpf.DataGrid.Group).IsBottomLevel)

                {

                    return Visibility.Visible;

         }

                Group group = (Group)value;   

                return Visibility.Hidden;

            }

     This seems to work fine in hiding the actual rows in the Datagrid but then i'm left with large white gaps where the hidden rows should have been. 

    (tried to attach image of the sample project showing the issue, but it doesn't seem to be working)

    http://s18.postimage.org/jzgzcr515/Datagrid.png 

    Any ideas on how to fix this issue would be welcome.

     

    Thanks in advance,

    --Jake 

     

  •  05-24-2012, 7:43 PM Post no. 32147 in reply to 32144

    Re: Hiding Grouped Rows

    Hi Jacob,

    This is normal because you are using TableflowView. The GroupHeaderControl area will always be calculated and assigned to the DataGrid whether it is visible or not. This is because of the smooth scrolling and the animations. The only other solution would be to use TableView, but then you will lose all scrolling animations. Currently, there is no other way except for the way you have coded it.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  05-25-2012, 11:10 AM Post no. 32152 in reply to 32147

    Re: Hiding Grouped Rows

    Hey Marc, 

    If we switch the control over to the TableView what would we have to do to get the white space in the rows to not be shown? I tried just switching it over to the TableView with the same code I posted above and the white space is still visible.

     --Jake 

  •  05-28-2012, 10:35 PM Post no. 32166 in reply to 32152

    Re: Hiding Grouped Rows

    Hi Jake,

    Instead of returning Hidden when it is not the bottom level, have it return Collapsed as the visibility. This will do the trick. Also, you might want to play around with the indenting of the Groups when the grouping levels start to accumulate. To do this, you will need to tinker with the template.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.