Hiding Group Header

3 posts, 0 answers
  1. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 10 Mar 2015 Link to this post

    I am using the solution from another thread to hide the group headers, that works fine but i can still see a small line/rectangle, is there a way to hide that. (attached image).

    Thanks
    vikas

    <local:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
                    <DataTemplate>
                        <ContentPresenter Content="{Binding FormattedName}" Height="0" Margin="0" Visibility="Collapsed" />
                    </DataTemplate>
                </local:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 13 Mar 2015 Link to this post

    Hello Vikas,

    Try using custom GroupHeaderStyleSelector instead of ContentTemplateSelector:

    public class CustomGroupHeaderStyleSelector : OrientedGroupHeaderStyleSelector
    {
        public Style CollapsedStyle { get; set; }
     
        public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
        {
            var groupHeader = container as GroupHeader;
            if (groupHeader != null)
            {
                var groupKey = groupHeader.GroupKey as Resource;
                if (groupKey != null)
                {
                    return this.CollapsedStyle;
                }
            }
     
            return base.SelectStyle(item, container, activeViewDeifinition);
        }
    }

    Make sure you have included all other Styles in xaml in order to have the GroupHeaders appear correctly:

    <Style TargetType="telerik:GroupHeader" x:Key="Collapsed">
        <Setter Property="Visibility" Value="Collapsed" />
        <Setter Property="Margin" Value="0 0 -1 0" />
        <Setter Property="Padding" Value="-1 0 0 0" />
    </Style>
     
    <local:CustomGroupHeaderStyleSelector x:Key="Selector"
            HorizontalStyle="{StaticResource HorizontalGroupHeaderStyle}"
            HorizontalTodayStyle="{StaticResource HorizontalTodayGroupHeaderStyle}"
            HorizontalBottomLevelStyle="{StaticResource HorizontalBottomLevelGroupHeaderStyle}"
            HorizontalTodayBottomLevelStyle="{StaticResource HorizontalBottomLevelTodayGroupHeaderStyle}"
            VerticalStyle="{StaticResource VerticalGroupHeaderStyle}"
            VerticalTodayStyle="{StaticResource VerticalTodayGroupHeaderStyle}"
            VerticalBottomLevelStyle="{StaticResource VerticalBottomLevelGroupHeaderStyle}"
            VerticalTodayBottomLevelStyle="{StaticResource VerticalBottomLevelTodayGroupHeaderStyle}"
            MonthViewWeekGroupStyle="{StaticResource MonthViewWeekGroupStyle}"
            MonthViewBottomLevelWeekGroupStyle="{StaticResource MonthViewBottomLevelWeekGroupStyle}"
            CollapsedStyle="{StaticResource Collapsed}">                                   
    </local:CustomGroupHeaderStyleSelector>

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vikas
    Vikas avatar
    64 posts
    Member since:
    May 2014

    Posted 13 Mar 2015 in reply to Kalin Link to this post

    Thanks, I will give this a try.

    vikas
Back to Top