Any way to make Month View slots (Saturday & Sunday) "hidden" or "minimized"? Any way to set the width of slots or make it resizable as ScheduleView?

2 posts, 0 answers
  1. Frankie
    Frankie avatar
    11 posts
    Member since:
    Jun 2011

    Posted 05 Jan 2012 Link to this post

    Hi all,

    I'm working on RadScheduleView to resemble a Month Calendar, and the only option is to use Month View Definition.
    In my applicaiton, users only have Appointments on working days (Mon to Fri) and the screen space of Sat/Sun empty slots on Month View will be wasted.

    Question (1):
    I read my posts in this Forum and found out hiding Saturday and Sunday in Month view is not supported by RadScheduleView.
    Then I try to find a work-around solution to set Styles of TimeRulerMonthViewItem and TimeRulerMonthViewGroupItem . This is what I have done, setting Visibility property binding to a convert to return Collapsed for Sat and Sun:
    <telerik:OrientedTimeRulerItemStyleSelector x:Key="TimeRulerItemStyleSelector"
                                                    MonthViewGroupStyle="{StaticResource timeRulerMonthViewGroupItemStyle}">        
            <telerik:OrientedTimeRulerItemStyleSelector.MonthViewTickStyle>
                <Style TargetType="local:TimeRulerMonthViewItem">
                    <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date, Converter={StaticResource ResourceKey=calendarDateColorConverter}}" />
                    <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date, Converter={StaticResource ResourceKey=calendarDateCollapsedConverter}}" />                
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="local:TimeRulerMonthViewItem">
                                <Border Background="{TemplateBinding Background}" 
                                        BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date, Converter={StaticResource ResourceKey=currentDateCalendarDateColorConverter}}" 
                                        BorderThickness="2" >
                                    <Grid Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date, Converter={StaticResource ResourceKey=calendarDateColorConverter}}">
                                        <telerik:RadButton Padding="0" VerticalAlignment="Top" Height="22" Command="local:RadScheduleViewCommands.SetDayViewMode" CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date}"
                                                           Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date, Converter={StaticResource ResourceKey=plainCalendarDateColorConverter}}"
                                                           Style="{StaticResource ResourceKey=GoToDayButtonStyle}">                                        
                                            <ContentPresenter Margin="{TemplateBinding Padding}" />                                        
                                        </telerik:RadButton>
                                        <telerik:RadToggleButton Visibility="{Binding ExpandButtonVisibility}" IsChecked="{Binding IsExpanded, Mode=TwoWay}" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                                                 Content="More..." FontSize="9" />
                                    </Grid>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </telerik:OrientedTimeRulerItemStyleSelector.MonthViewTickStyle>        
        </telerik:OrientedTimeRulerItemStyleSelector>

    And I set the Border visibility property as well with the same binding and converter. The outcome of the ScheduleView is showing empty slots but Sat/Sun are still there and Appointments for Sat/Sun on empty slots.
    Is there any thought on how to actually hide and making the slot collapsed?

    Question 2:
    Is there any way to set the width and height of the slot in Month View?
    I had customized Appointment template which shows at least three lines of information for an Appointment. And I don't want the user to always click Expand button to see all the details. Is there any way to always show "Expanded" slot in Month View?

    Many many thanks!

    Frankie
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 09 Jan 2012 Link to this post

    Hello Frankie,

    Straight to your questions:

    1) There is no way to force MonthView to display less than 7 days. In short it is a view grouped by week and will always display 7 days, even if you set the Visibility of those slots to Collapsed.

    2) Yes, you can customize the size of the slots.

    What stretches the view are actually the time ruler items. Usually you will need to implement the TimeRulerItemStyleSelector in order to change size of the view.

    In the specific case of slot height in MonthView, however, you should implement the GroupHeaderStyleSelector and modify the MonthViewBottomLevelWeekGroupStyle. Change the MinHeight in this style to a number fitting your scenario.

    Please, note that slots height is calculated in such a way that it cannot be auto. This means that you cannot show the expanded slot when there are many appointments and collapsed when there are only a few. You should set a fixed size to the slot using the MinHeight property as adviced.

    I hope this will help.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top