Posted
on Jan 26, 2012
(permalink)
Hello George,
KAKA's concern is to have a code to link dynamically Binding
SelectedAppointment of the xaml (View) in ViewModel.
I managed to do dynamic linking with AppointmentsSource whose code is below.
I also worry what will work in the development of My Schedule appointment.
Thank you for sending a response.
"
<telerik:RadScheduler x:Name="scheduler"
AppointmentsSource="{Binding Path=Appointments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedAppointment="{Binding Path=SelectedAppointment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
AllowDrop="False"
>
private ObservableCollection<Appointment> mAppointments;
public ObservableCollection<Appointment> Appointments
{
get
{
return this.mAppointments;
}
set
{
this.mAppointments = value;
this.OnPropertyChanged("Appointments");
}
}
IEnumerable<Appointment> query = moduleService.GetRendeVousData();
Appointments = new ObservableCollection<Appointment>(query);
public IEnumerable<Appointment> GetRendeVousData()
{
AutoSecureCaisseEntities db = new AutoSecureCaisseEntities();
var query = (from r in db.RendezVous select r);
var rendezVous = (from c in query
orderby c.OperateurDateModification descending
select new Appointment()
{
Body = c.Objet,
Subject = c.Objet,
Start = c.DateDebutRDV,
End = c.DateFinRDV,
Importance = Importance.Low,
IsAllDayEvent = false,
Location = AuthenticationContext.Current.CodeStation,
});
return rendezVous;
}
"