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

Retemplating MonthView background

4 Answers 80 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Håkan
Top achievements
Rank 1
Håkan asked on 23 Aug 2011, 02:51 PM
Hi,

I have modified the ControlTemplate of the MonthView style called "TimeRuleMonthViewItemStyle"
I made the GoToDay button stretch vertically over the whole area. The content of the button is also replaced by a stackpanel like this:
<Style x:Key="TimeRulerMonthViewItemStyle" TargetType="local:TimeRulerMonthViewItem">
        <Setter Property="Foreground" Value="{StaticResource MonthViewTimeRulerItemForeground_Normal}" />
        <Setter Property="Margin" Value="0 -1 -1 1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TimeRulerMonthViewItem">
                    <Grid>
                        <telerik:RadButton VerticalAlignment="Stretch" Padding="0" Style="{StaticResource GoToDayButtonStyle}" Command="local:RadScheduleViewCommands.SetDayViewMode" CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.DateTime.Date}">
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center" IsHitTestVisible="False">
                                <TextBlock Text="{Binding Content.DateTime.Day, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{StaticResource TextBrush}" Opacity="0.75" HorizontalAlignment="Center" FontSize="24" />
                                <TextBlock Text="{Binding Content.DateTime, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DateTimeConverter}, ConverterParameter='MMMM'}" Foreground="{StaticResource TextBrush}" Opacity="0.75" HorizontalAlignment="Center" FontSize="10" Margin="0,-10,0,0" />
                            </StackPanel>
                        </telerik:RadButton>
                    </Grid>              
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

This works fine, but I also use colored backgrounds for saturdays and sundays with special slots.
And they will not fill the whole area (see attached image).
I have looked everywhere but can't find what margin or other setting that might cause this.

Regards,
Håkan


4 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 25 Aug 2011, 03:09 PM
Hi,

This space is controlled by the Padding property of the bottom level GroupHeader in MonthView. You could create a custom GroupHeader StyleSelector and set the Padding property to have its Top value decreased in MonthView. You could find more information about the StyleSelector here.

Kind regards,
Pana
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Håkan
Top achievements
Rank 1
answered on 01 Sep 2011, 10:31 AM
Hi,

I tried to change the padding in the MonthViewBottomLevelWeekGroupStyle.
The default value was "0 -2 0 0". But all that happenened was that all appointments were moved up, but the background color from the special slots remained on the exact same spot as in my previously posted image.

Regards,
Håkan
0
Accepted
Pana
Telerik team
answered on 03 Sep 2011, 08:02 AM
Hello,

I am really really sorry. We have designed the GroupHeaders to control the positioning of appointments. We had the intention to make it offset the special slots too but later found some issues I forgot about.

The easiest way to position the slots would be to create a ScheduleViewStyleSelector similar to the selectors for appointment and GroupHeader styles. When you override the SelectStyle method you will get the view definition. If it is month you should return a custom style if it is not - the default. The custom style should have negative top margin to drag the appointment's top a little bit up.

Please check the attached project for a style that does so in MonthView. The selector sets only one style for all views though. You can find more resources how to create a custom selector here:
http://www.telerik.com/help/silverlight/radscheduleview-styles-and-templates-styling-groupheaders.html
The selector for special slots should work pretty much the way CustomGroupHeaderStyleSelector works. Only it should have conditions like "if (activeViewDeifinition is MonthViewDefinition)" and should return Styles for HighlightItem

All the best,
Pana
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Håkan
Top achievements
Rank 1
answered on 06 Sep 2011, 08:09 AM
Works fine now, thanks!

Regards,
Håkan
Tags
ScheduleView
Asked by
Håkan
Top achievements
Rank 1
Answers by
Pana
Telerik team
Håkan
Top achievements
Rank 1
Share this question
or