This is a migrated thread and some comments may be shown as answers.

Hiding Group Header

2 Answers 131 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 10 Mar 2015, 07:26 PM
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 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 13 Mar 2015, 02:12 PM
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.

 
0
Vikas
Top achievements
Rank 1
answered on 13 Mar 2015, 02:17 PM
Thanks, I will give this a try.

vikas
Tags
ScheduleView
Asked by
Vikas
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Vikas
Top achievements
Rank 1
Share this question
or