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

AppointmentTemplate is not working properly

5 Answers 147 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
palak
Top achievements
Rank 1
palak asked on 21 Jun 2011, 02:16 PM
Dear telerik,

I've a one dropdown(out of scheduleview) for localization and in that dropdown there are different languages option available.
I've made one AppointmentTemplate which is like below:

<DataTemplate x:Key="AppointmentTemplate">
           <Grid>
               <Grid.RowDefinitions>
                   <RowDefinition Height="Auto"/>
                   <RowDefinition Height="Auto"/>
                   <RowDefinition Height="Auto"/>
                   <RowDefinition Height="*"/>
 
               </Grid.RowDefinitions>
               <TextBlock Grid.Row="0" Text="{Binding Appointment.Resources[1].ResourceName}"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Top" FontSize="13" Foreground="Black" FontWeight="Bold" />
               <TextBlock Grid.Row="1" Text="{Binding Appointment.Subject}"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Top" FontSize="9" Foreground="Black" FontWeight="Bold"/>
               <TextBlock Grid.Row="2" Text="{Binding Appointment.Body}"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Top" FontSize="9" Foreground="Black" FontWeight="Bold" />
               <TextBlock Grid.Row="3" Text="{Binding Appointment.Start}"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Top" FontSize="9" Foreground="Black" FontWeight="Bold"/>
           </Grid>
       </DataTemplate>


Now i assign this template in RadScheduleview like below:

AppointmentItemContentTemplate="{StaticResource AppointmentTemplate}"

My problem is like, whenever i change language from my dropdown, appointment item template works strange way.
Like there is 5 language ,i randomly change language(spanish,french,turkis etc.), and appointment template items getting hidden means some shows up(resourcename only), some gone(subject,body etc.) , sometimes it shows all items in appointment template, sometimes for the same option(like spanish or turkish etc.), few items gone. sometimes for some apointments(random in current view), appointment template shows up all items, for some appointments, some items gone.

I mean to say, appointment template is working partially, not seamlessly.

kindly check, if you need, i'll give u sample.

thanks & regards


 


5 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 24 Jun 2011, 10:44 AM
Hello,

One of the problems I have found is that the binding to 'Appointment.Resources[1]' would sometimes bind to one resource type sometimes to other. There is no definition about which resource will get first in the appointment and which second so having the ScheduleView grouped by both Rooms and Speaker and moving the appointments around would sometimes show room number, sometimes speaker name.

As for the Subject and Body I have failed to reproduce the problem. Could you give me the code that actually execute when you change the selection from your dropdown and change the localization? I wish to further test that issue.

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
0
palak
Top achievements
Rank 1
answered on 24 Jun 2011, 11:33 AM
hi pana,

I agree about your opinion regarding 'Appointment.Resources[1]' as i had to intentionally set this workaround because i was not able to point out by resource name or another way(in .xaml and .xaml.cs both, if you have solution , share with us). While dragging or dropping or any operations, i am reloading my appointments quickly after, so it gets right value for appointment template.
My problem is appointment template always have all values, but some goes, some comes up, sometimes all shows up for some appointments but not for some appointments.

As i am working with sharepoint 2010, it would be timeconsuming for you to reproduce the problem if i'll give u solution directly. so here is a sample code related to my problem. ask me if anything still needed even project also.

here is localization dropdown code :

private void AvailableCulturesComboBox_SelectionChanged(object sender, EventArgs e)
 {
     LocalizationManager.DefaultCulture = (CultureInfo)(sender as Telerik.Windows.Controls.RadComboBox).SelectedItem;
     //LocalizationManager.DefaultCulture = (CultureInfo)AvailableCulturesComboBox.SelectedItem;
     //this.SchedulerView.AppointmentItemContentTemplate.LoadContent();
     Dispatcher.BeginInvoke(ResetTemplate);
 }
 
 public static List<CultureInfo> SupportedCultures
 {
     get
     {
         if (_SupportedCultures == null)
         {
             _SupportedCultures = new List<CultureInfo>();
             _SupportedCultures.Add(CultureInfo.InvariantCulture);
             _SupportedCultures.Add(new CultureInfo("en-us"));
             _SupportedCultures.Add(new CultureInfo("hi-IN"));
             _SupportedCultures.Add(new CultureInfo("es"));
             _SupportedCultures.Add(new CultureInfo("de"));
             _SupportedCultures.Add(new CultureInfo("tr"));
             _SupportedCultures.Add(new CultureInfo("it"));
             _SupportedCultures.Add(new CultureInfo("nl"));
         }
 
         return _SupportedCultures;
     }
 }
 
 private void ResetTemplate()
 {
     ControlTemplate template = this.SchedulerView.Template;
     this.SchedulerView.Template = null;
     this.SchedulerView.Template = template;
 }

Here is my custom appointment Class :

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.ScheduleView;
 
namespace HaiderSchedulerView
{
    public class ResourceAppointment : Appointment
    {
        #region Members & properties
 
        private int _AppointmentId;
        private string _CreatedBy;
        private string _ModifiedBy;
         
        public int AppointmentId
        {
            get
            {
                return this.Storage<ResourceAppointment>()._AppointmentId;
            }
            set
            {
                var storage = this.Storage<ResourceAppointment>();
                if (storage._AppointmentId != value)
                {
                    this._AppointmentId = value;
                    this.OnPropertyChanged(() => this.AppointmentId);
                }
            }
        }
 
        public string CreatedBy
        {
            get
            {
                return this.Storage<ResourceAppointment>()._CreatedBy;
            }
            set
            {
                var storage = this.Storage<ResourceAppointment>();
                if (storage._CreatedBy != value)
                {
                    this._CreatedBy = value;
                    this.OnPropertyChanged(() => this.CreatedBy);
                }
            }
        }
 
        public string ModifiedBy
        {
            get
            {
                return this.Storage<ResourceAppointment>()._ModifiedBy;
            }
            set
            {
                var storage = this.Storage<ResourceAppointment>();
                if (storage._ModifiedBy != value)
                {
                    this._ModifiedBy = value;
                    this.OnPropertyChanged(() => this.ModifiedBy);
                }
            }
        }
 
        #endregion
 
        public override IAppointment Copy()
        {
            var appointment = new ResourceAppointment();
            appointment.CopyFrom(this);
            return appointment;
        }
        public override void CopyFrom(IAppointment other)
        {
            
            var appointment = other as ResourceAppointment;
            if (appointment != null)
            {
                this.AppointmentId = appointment.AppointmentId;
                this.Subject = appointment.Subject;
                this.Start = appointment.Start;
                this.End = appointment.End;
                this.Body = appointment.Body;
                this.CreatedBy = appointment.CreatedBy;
                this.ModifiedBy = appointment.ModifiedBy;
            }
             base.CopyFrom(other);
        }
    }
}

Resources , Rooms, and appointments are binding dynamically.
First Rooms are getting bound, then resources, and then appointments getting bound , sequentially.

thanks & regards
0
palak
Top achievements
Rank 1
answered on 29 Jun 2011, 09:51 AM
Hi pana,

have you got anything related to my problem ?

thanks & regards
palak
0
Ivo
Telerik team
answered on 30 Jun 2011, 04:34 PM
Hi Palak,

I tried to reproduce the issue without any success. I have attached a working sample project based on your code. It will be very helpful to us if you modify it so the problem to appear and send it back to us.

Regards,
Ivo
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
palak
Top achievements
Rank 1
answered on 02 Jul 2011, 03:39 PM
Thanks for project, i've checked and compared logic, there is not problem i have come across in my solution so problem is still there.

 i'll upload updated project very soon.

thanks & regards
palak
Tags
ScheduleView
Asked by
palak
Top achievements
Rank 1
Answers by
Pana
Telerik team
palak
Top achievements
Rank 1
Ivo
Telerik team
Share this question
or