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

Display data in monthview

3 Answers 132 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 03 Jun 2011, 12:28 PM
Hi,

I'm using the MonthView as a calendar where I want to display some information on specific dates.
For example I want to show the text "Christmas Day" on the 25:th of december.
I also have other kind of data related to specific dates.

I have bound the ScheduleView to an appointment source which has one, and only one, item per day.
The appointment source is a collection of a modified Appointment class where I have added some properties that I want to use.
I have also modified the TimeRulerMonthViewItemStyle and added a TextBlock there where I want to display some text in.
How can I bind that TextBlock to data in my appointment source?

If it can't be done in XAML, is there anyway I can do it in code?

Regards,
HÃ¥kan

3 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 08 Jun 2011, 01:37 PM
Hello,

Can you send us a screenshot of ScheduleView and paint over it what you are trying to achieve. In general there is no way to set your own data in the month view's time ruler data. Perhaps we can do something with the appointments?

Best wishes,
Pana
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Håkan
Top achievements
Rank 1
answered on 09 Jun 2011, 09:41 AM
Hi!

Actually I'm not trying to display it in the time ruler, but in the background of the day (see screenshot).

I want to use the MonthView as a calendar. It should display holiday names like the screen shot, I also want the background to be a little red for sundays and holidays using the SpecialSlots if possible.

And, as you can see in the screen shot I have five small boxes each day that should display a number.
The application is a scheduling application, and the boxes display for example "Number of assigned shifts", "Number of unassigned shifts" etc for that specific date. When you select a date, the DayView will show the different shifts.

I try to solve this by using an appointment collection when in the DayView and another collection in the MonthView.
The MonthView collection has one, and only one, record per day that will hold my desired information, like a holiday name and the numbers to display in the five boxes.
My problem is how to bind the boxes to this item.

Right nom my TimeRulerMontViewItem control template looks like this:
<Style x:Key="TimeRulerMonthViewItemStyle" TargetType="telerik:TimeRulerMonthViewItem">
        <Setter Property="Foreground" Value="{StaticResource MonthViewTimeRulerItemForeground_Normal}"/>
        <Setter Property="Margin" Value="0 -1 -1 0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:TimeRulerMonthViewItem">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="24" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <telerik:RadButton Grid.ColumnSpan="2" Grid.RowSpan="5" CommandParameter="{Binding Content.DateTime.Date, RelativeSource={RelativeSource TemplatedParent}}" Command="local:RadScheduleViewCommands.SetDayViewMode" Padding="0" Style="{StaticResource MonthGoToDayButtonStyle}" VerticalAlignment="Stretch">
                            <!--<ContentPresenter Margin="{TemplateBinding Padding}"/>-->
                        </telerik:RadButton>
                        <Border Grid.Row="0" Background="{StaticResource GradientLightBlue}" BorderBrush="{StaticResource ContentBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2" Margin="3,3,3,2">
                            <TextBlock Text="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="8" />
                        </Border>
                        <Border Grid.Row="1" Background="{StaticResource GradientLightGreen}" BorderBrush="{StaticResource ContentBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2" Margin="3,1,3,2">
                            <TextBlock Text="0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextBrush}" FontSize="8" />
                        </Border>
                        <Border Grid.Row="2" Background="{StaticResource GradientLightYellow}" BorderBrush="{StaticResource ContentBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2" Margin="3,1,3,2">
                            <TextBlock Text="0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextBrush}" FontSize="8" />
                        </Border>
                        <Border Grid.Row="3" Background="{StaticResource GradientLightOrange}" BorderBrush="{StaticResource ContentBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2" Margin="3,1,3,2">
                            <TextBlock Text="0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextBrush}" FontSize="8" />
                        </Border>
                        <Border Grid.Row="4" Background="{StaticResource GradientLightRed}" BorderBrush="{StaticResource ContentBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2" Margin="3,1,3,3">
                            <TextBlock Text="0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextBrush}" FontSize="8" />
                        </Border>
                        <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="0" Grid.RowSpan="5" 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:RadToggleButton Grid.Column="1" Grid.Row="1" Grid.RowSpan="5" HorizontalAlignment="Right" IsChecked="{Binding IsExpanded, Mode=TwoWay}" Style="{StaticResource ExpandMonthViewButtonStyle}" Visibility="{Binding ExpandButtonVisibility}" VerticalAlignment="Bottom"/>-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
If it's not possible to do it this way, maybe I can use a whole day event and modify the style of the appointment to fill the whole area of the day some how?

Hope you understand my explanation.

Regards,
HÃ¥kan
0
Pana
Telerik team
answered on 16 Jun 2011, 01:43 PM
Hello,

I would suggest you to wait the release of the upcoming beta. It is just a few days away. It will offer a Filter for appointments.

You would be able to create one appointment source that has both assignments for shifts and summary appointments that will have data for summarization of shift assignments. The different views can filter the appointments so the DayView would show the real appointments while the MonthView will show only the summary appointments. Later you can apply a custom style to the summary appointments using the AppointmentItemStyleSelector so they look like the small cells you draw.

Regards,
Pana
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
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