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

To set background for timeline grid cell

3 Answers 79 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
zxp
Top achievements
Rank 1
zxp asked on 26 Dec 2011, 03:50 AM
I want to change all the grid cells' background. Using SpecialSlotStyleSelector is the only way. Is that true?
I have setted  StretchAppointments="True" in TimelineViewDefinition. There are still some blanks at the top and bottom (see the attach) for the appoinement item. How can I grid rid of them.
Thanks.
Merry Christmas!

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 27 Dec 2011, 11:40 AM
Hello,

Yes, you should use the SpecialSlotStyleSelector to change background of slots.

Additionally, to remove appointment margin you need to apply a negative margin to the horizontal appointment item. This can be done with a simple style. For example:
<telerik:OrientedAppointmentItemStyleSelector x:Key="MyAppointmentStyle">
            <telerik:OrientedAppointmentItemStyleSelector.HorizontalStyle>
                <Style TargetType="telerik:AppointmentItem">
                    <Setter Property="Margin" Value="0 -1 0 -4" />
                </Style>
            </telerik:OrientedAppointmentItemStyleSelector.HorizontalStyle>
        </telerik:OrientedAppointmentItemStyleSelector>

I hope this helps.

Kind regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
zxp
Top achievements
Rank 1
answered on 30 Dec 2011, 04:46 AM
Thanks.
Using OrientedAppointmentItemStyleSelector , I can do many things.

For a recurrence slot daily, this start time can be setted to DateTime.MinValue. See this:
            m_spareRoomSlots = new ObservableCollection<Slot>();

            //DateTime start = DateTime.Now.Date.AddYears(-120);
            DateTime start = DateTime.MinValue;
            DateTime end = start.AddDays(1).AddSeconds(-1);
            RecurrencePattern rp = new RecurrencePattern();
            rp.Frequency = RecurrenceFrequency.Daily;
            specialSlot = new Slot(start, end);
            specialSlot.RecurrencePattern = rp;

            m_spareRoomSlots.Add(specialSlot);

I can set the start time to a very small value.

Happy new years.
0
Dani
Telerik team
answered on 03 Jan 2012, 02:57 PM
Hello,

Yes, you could create special slots using DateTime.MinValue. Maybe you should just be careful not to cause any performance issues at some point.

The thing that happens when using special slots all along the view is that ticks of the time ruler get hidden if you use a solid background for the special slots. This is because slots are drawn on top of the time ruler grid. I suggest that you set a semitransparent background when using the SpecialSlotSelector.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ScheduleView
Asked by
zxp
Top achievements
Rank 1
Answers by
Dani
Telerik team
zxp
Top achievements
Rank 1
Share this question
or