To set background for timeline grid cell

4 posts, 0 answers
  1. zxp
    zxp avatar
    2 posts
    Member since:
    Mar 2011

    Posted 25 Dec 2011 Link to this post

    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!

  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 27 Dec 2011 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. zxp
    zxp avatar
    2 posts
    Member since:
    Mar 2011

    Posted 29 Dec 2011 Link to this post

    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.
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 03 Jan 2012 Link to this post

    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 >>
Back to Top