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

TimelineView: Vertical Alignment and Size of Appointments

1 Answer 212 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 28 Jan 2011, 03:48 PM
Hi,

   Currently, the appointment items are aligned at the top of their group's row and do not fill the space.

   I would like to vertically align the appointment items to be centered, as well as make them slightly larger (height).

   Playing with styles, I noticed that VerticalAlignment property does not respond at all, and modifying Height and/or Margin on AppointmentItem will cause strange clip and layout issue.

   Any suggestion?

Robert.

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 31 Jan 2011, 09:07 AM
Hi Robert,

All appointments are contained inside a Panel items control, so if you center the panel, the appointments will also be vertically centered. In the default control template of RadScheduleView you will find the following element:

<telerik:AppointmentsPanel x:Name="PART_ItemsHost" Grid.ColumnSpan="2" Grid.Column="0" Orientation="{TemplateBinding EffectiveOrientation}" Grid.Row="1"/>

You can insert VerticalAlignment="Center" in order to center the appointments.

If you wish to give your appointments a certain default size, you can play with the MinAppointmentWidth and MinAppointmentHeight properties to achieve the desired result.

I hope this helps.

All the best,
Dani
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Simon
Top achievements
Rank 1
Iron
commented on 24 Aug 2022, 02:41 PM

Hi Dani,

I've found this old thread, looking for a solution for the exact same problem as Robert describes it.

Can you Dani - or one of your colleagues  - please explain more detailed where I have to insert the VerticalAlignment property? Do I have to replace the whole control template of RadScheduleView?

Greetings from Germany,

Simon

Stenly
Telerik team
commented on 29 Aug 2022, 09:58 AM

Hello Simon,

The suggestion provided by my colleague is to extract the default control template of the RadScheduleView control and set the VerticalAlignment property to "Center" of the AppointmentsPanel element (with x:Name="PART_ItemsHost"). This is one way of setting the VerticalAlignment property of the element and additional information on how to extract and edit the default control templates of our controls can be found here.

An alternative approach would be to retrieve the AppointmentsPanel element by using the Visual Tree Helpers methods. For example, the retrieval of this element can be done on the Loaded event of the RadScheduleView control. The following code snippet shows a sample implementation of this suggestion:

private void RadScheduleView_Loaded(object sender, RoutedEventArgs e)
{
    RadScheduleView radScheduleView = (RadScheduleView)sender;

    AppointmentsPanel appointmentsPanel = radScheduleView.ChildrenOfType<AppointmentsPanel>().FirstOrDefault(x => x.Name == "PART_ItemsHost");

    if (appointmentsPanel != null)
    {
        appointmentsPanel.VerticalAlignment = VerticalAlignment.Center;
    }
}

Both of these approaches will allow you to set the VerticalAlignemt property, which will center the appointments on the AppointmentsPanel, rather than showing them at the top.

Simon
Top achievements
Rank 1
Iron
commented on 30 Aug 2022, 01:18 PM

Thank you very much for your support, Stanly.

Simon
Top achievements
Rank 1
Iron
commented on 01 Sep 2022, 09:25 AM

Hello Stanly,

thanks again for your support.

I'd like to give you some feedback. After discussion with my fellow developers, we decided to drop this little requirement, because it is not very critical for us and we think it is poor code style to either copy the whole template code or access the object via reflection at runtime.

If there are any plans to expose this property via API in the future, please let me know. We would be happy to implement this feature than.

Best regards,

Simon

Tags
ScheduleView
Asked by
Robert
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or