Width of GroupHeaders

2 posts, 0 answers
  1. Matthias
    Matthias avatar
    6 posts
    Member since:
    Jan 2016

    Posted 26 Feb Link to this post

    Hi,

    is there a way to prevent the vertical weekview from showing horizontal scrollbars by narrowing the groupheaders to the available space? I also realized, that when you put a lot of appointments into one slot, this group gets more space than the others.

    What I want is, that every column has the exact same width and they use only the space available in the current window without horizontal scrolling.

    Thanks

    Matthias

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 29 Feb Link to this post

    Hi Matthias,

    You could narrow the width of the GroupHeaders in WeekViewDefinition by customizing the GroupHeaderContentTemplateSelector of RadScheduleView,   you will need to set Width inside its HorizontalTemplate, please check the following snippet:

    <telerik:GroupHeaderTemplateSelector x:Key="GroupHeaderContentTemplateSelector">
        <telerik:GroupHeaderTemplateSelector.HorizontalTemplate>
            <DataTemplate>
                <!--Change the Width here-->
                <TextBlock Text="{Binding Name, StringFormat={}{0:ddd}}" Margin="2" Width="25"/>
            </DataTemplate>
        </telerik:GroupHeaderTemplateSelector.HorizontalTemplate>
        <telerik:GroupHeaderTemplateSelector.VerticalTemplate>
            <DataTemplate>
                <ContentPresenter Content="{Binding FormattedName}" Margin="4" Height="16" VerticalAlignment="Top">
                    <ContentPresenter.LayoutTransform>
                        <RotateTransform Angle="-90"/>
                    </ContentPresenter.LayoutTransform>
                </ContentPresenter>
            </DataTemplate>
        </telerik:GroupHeaderTemplateSelector.VerticalTemplate>
    </telerik:GroupHeaderTemplateSelector>

    The approach is explained in details in Templating the GroupHeaders topic in our documentation.

    This, however, will not prevent having wider groups when there are more appointments, you could set MinAppointmentWidth property of the ScheduleView to a smaller value in order to avoid this to some extent:

    <telerik:RadScheduleView x:Name="radScheduleView"
        AppointmentsSource="{Binding Appointments}"                            
        GroupHeaderContentTemplateSelector="{StaticResource GroupHeaderContentTemplateSelector}"
        MinAppointmentWidth="5">


    Hope this will be helpful.

    Regards,
    Yana
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top