Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Scheduler > Bind with object of inheritance of AppointmentBase

Not answered Bind with object of inheritance of AppointmentBase

Feed from this thread
  • cayo fontana avatar

    Posted on Oct 26, 2011 (permalink)

    Hi Telerik Team,

    Please, look this code below:

    --------

    XAML:
    <telerik:RadScheduler x:Name="rscAgenda"
                            Grid.Column="0"
                            Grid.Row="0"
                            Grid.ColumnSpan="1"
                            Grid.RowSpan="1"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            telerik:StyleManager.Theme="Vista"
                            ViewMode="Week"
                            DisplayEmptyGroup="True"
                            OpenModalDialogs="True"
                            AppointmentsSource="{Binding agendacollection}"
                            AppointmentCreating="rscAgenda_AppointmentCreating"
                            AllDayAreaHeight="0"
                            FirstDayOfWeek="Tuesday"
                            Culture="pt-BR"
                            ShowsConfirmationWindowOnDelete="False"
                            AppointmentEditing="rscAgenda_AppointmentEditing"
                            SelectedViewStartDateChanged="rscAgenda_SelectedViewStartDateChanged"
                            ActiveViewDefinitionChanged="rscAgenda_ActiveViewDefinitionChanged"
                            AppointmentDeleting="rscAgenda_AppointmentDeleting">

        <telerik:RadScheduler.DayViewDefinition>
            <telerik:DayViewDefinition DayStartTime="08:00:00"
                                        DayEndTime="20:00:00"
                                        TimeSlotLength="0:30:0" />
        </telerik:RadScheduler.DayViewDefinition>

        <telerik:RadScheduler.WeekViewDefinition>
            <telerik:WeekViewDefinition DayStartTime="08:00:00"
                                        DayEndTime="20:00:00"
                                        TimeSlotLength="0:30:0"
                                        LargeChangeInterval="7d"
                                        VisibleDays="5" />
        </telerik:RadScheduler.WeekViewDefinition>
    </telerik:RadScheduler>

    C#:
    //In the class where XAML contains RadScheduler Control:
    public ObservableCollection<AppointmentBase> agendacollection { get; set; }
    private AppointmentBase agendamento;

    //Into constructor default of this class:
    this.agendacollection = new ObservableCollection<AppointmentBase>();
    ObterAgendamentos();

    //Implementation of Method ObterAgendamentos():
    private void ObterAgendamentos()
    {
        // Object AgendamentoBE is a Class of Model Layer
        List<AgendamentoBE> lstAgendamentos = this.agendamentoBLF.ObterAgendamentos(false, null, null, string.Empty, string.Empty, string.Empty, null, null);

        // Object EPDESK.Agendamento.Comum.Agendamento is a Class of ModelView. This inherits of AppointmentBase
        EPDESK.Agendamento.Comum.Agendamento agendamento;

        // Below, i makes attribution to this.agendamento (Type AppointmentBase) from agendamento (Type EPDESK.Agendamento.Comum.Agendamento)
        foreach (AgendamentoBE _agendamentoBE in lstAgendamentos)
        {
            agendamento = new EPDESK.Agendamento.Comum.Agendamento();
            agendamento = Comum.Agendamento.Novo(_agendamentoBE);
            this.agendamento = agendamento;
            this.agendacollection.Add(this.agendamento);
        }

        this.rscAgenda.AppointmentsSource = this.agendacollection;
    }

    ----------

    The end of this routine, the control this.rscAgenda.AppointmentsSource have 5 items, but they dont show in screen. Whats happened?

    Anyone help me?

    Note: The event AppointmentCreating="rscAgenda_AppointmentCreating" works perfectly.

    Thanks

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Scheduler > Bind with object of inheritance of AppointmentBase
Related resources for "Bind with object of inheritance of AppointmentBase"

WPF Scheduler Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]