Is there a way to make the 'TimeRulerMonthViewItemStyle' height shorter?

5 posts, 0 answers
  1. Ramski
    Ramski avatar
    10 posts
    Member since:
    Oct 2009

    Posted 27 Mar 2012 Link to this post

    I'm using a scheduleview that shows just a few data on every month, the problem is it makes a lot of white space because of the scheduleview's height.
    Is there a way to make the group items height shorter? mainly the 'TimeRulerMonthViewItemStyle'. considering it wont break the calendar. 
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 27 Mar 2012 Link to this post

    Hello Ramil,

    You can change the height of the slots in MonthView, as suggested in this thread. Use the GroupHeaderStyleSelector for this purpose. Here you can find more details on the selector and implementing it in your project.

    Hope this helps.

    Regards,
    Dani
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Ramski
    Ramski avatar
    10 posts
    Member since:
    Oct 2009

    Posted 27 Mar 2012 Link to this post

    Hi Dani,

    Thanks for the reply, I tried changing the MaxHeight of MonthViewBottomLevelWeekGroupStyle but it broke the layout of the calendar. Also tried using MinHeight instead, like the one you said in the other post but it didn't work. Any other way to change the height property for the MonthViewBottomLevelWeekGroupStyle?

    Thanks,
    Ramil
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 03 Apr 2012 Link to this post

    Hello Ramil,

    Since width or height of the month view week group headers is equally divided, group headers cannot be set a fixed width or height, but can be manipulated through MinHeight and MaxHeight (or respective width) properties.

    Well, changing the MinHeight or MaxHeight in your case is probably not working because the content of one or more of the group headers does not allow it, i.e. the text of some of the group headers cannot be minimized any more than it is now. This content is presented by a ContentPresenter which does not support TextTrimming so basically you cannot shrink the group headers any more.

    What you can do is remove the rotation of the vertical group headers. The result will look something similar to the attached 01.png and 02.png. This is done by removing the LayoutTransformControl in the VerticalTemplate of the GroupHeaderTemplateSelector and leaving only a single ContentPresenter, instead:
    <local:GroupHeaderTemplateSelector.VerticalTemplate>
                <DataTemplate>
                    <ContentPresenter Content="{Binding FormattedName}" Width="120" />
                </DataTemplate>
    </local:GroupHeaderTemplateSelector.VerticalTemplate>

    Something else you can do is simply remove the week group headers by setting Height and Width to 0:
    <Style x:Key="MonthViewBottomLevelWeekGroupStyle" TargetType="local:GroupHeader" BasedOn="{StaticResource GroupHeaderBaseStyle}">
                <Setter Property="Margin" Value="0 0 0 -1" />
                <Setter Property="Height" Value="0" />
                <Setter Property="Width" Value="0" />
    </Style>

    Result on the attached 03.png. Of course, that is if your scenario allows it.

    I hope this info will help in your case.

    Regards,
    Dani
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Dani
    Admin
    Dani avatar
    848 posts

    Posted 03 Apr 2012 Link to this post

    Hi,

    And here are the screenshots.

    Regards,
    Dani
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner