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

Show AppointmentDialogWindow manually

8 Answers 120 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
NickName
Top achievements
Rank 1
NickName asked on 01 Aug 2011, 09:18 AM
How can I show AppointmentDialogWindow manually? For now I can do it nly throught double clicking on time slot. But what if I want to show it by clicking on my custom button?

thank you.

8 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 01 Aug 2011, 09:24 AM
Hello,

You can use CreateAppointment command in order to show the EditAppointmentDialog:

var newApp = new Appointment()
{
      Start = DateTime.Now,
      End = DateTime.Now.AddHours(2)
};
RadScheduleViewCommands.CreateAppointment.Execute(newApp,ScheduleView);

Hope this helps.

All the best,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
NickName
Top achievements
Rank 1
answered on 01 Aug 2011, 11:59 AM
Doesn`t work :(

public partial class MainPage : UserControl, INotifyPropertyChanged
    {
        private ObservableCollection<IAppointment> appointments;

        /// <summary>
        /// Initializes a new instance of the <see cref="MainPage"/> class.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();

            this.Appointments = new ObservableCollection<IAppointment>();

            this.Loaded += this.MainPage_Loaded;
        }

        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.LayoutRoot.DataContext = this;

            this.Appointments.Clear();

            var apps = DataProvider.GetAppointments();
            foreach (var appointment in apps)
            {
                this.Appointments.Add(appointment);
            }
        }

        public ObservableCollection<IAppointment> Appointments
        {
            get
            {
                return this.appointments;
            }

            set
            {
                this.appointments = value;

                if (this.PropertyChanged != null)
                {
                    this.PropertyChanged(this, new PropertyChangedEventArgs("Appointments"));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var newApp = new Appointment
            {
                Start = DateTime.Now,
                End = DateTime.Now.AddHours(2)
            };

            RadScheduleViewCommands.CreateAppointment.Execute(newApp, appointmentScheduleView);
        }
    }

<Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
       
        <Button Click="Button_Click" Content="click" />

        <schedule:RadScheduleView Grid.Row="1"
                x:Name="appointmentScheduleView"
                AppointmentsSource="{Binding Appointments, Mode=TwoWay}"
                BorderBrush="{x:Null}"
                GroupHeaderContentTemplateSelector="{x:Null}">

            <schedule:RadScheduleView.ViewDefinitions>
                <schedule:MonthViewDefinition Title="Month View" DayStartTime="8:30" DayEndTime="18:00" />
                <schedule:WeekViewDefinition Title="Week View" FirstDayOfWeek="Monday" VisibleDays="5"
                                                 Orientation="Horizontal" DayStartTime="8:30" DayEndTime="18:00" />
                <schedule:DayViewDefinition Title="Day View" DayStartTime="8:30" DayEndTime="18:00"
                                                Orientation="Vertical" />

            </schedule:RadScheduleView.ViewDefinitions>

        </schedule:RadScheduleView>

    </Grid>
0
NickName
Top achievements
Rank 1
answered on 02 Aug 2011, 09:18 AM
Any body ???
I can not believe that there is no opportunity to raise the dialog box itself. The previous solution does not work.

Thank you.
0
Accepted
Yana
Telerik team
answered on 02 Aug 2011, 12:41 PM
Hello,

The problem in your code is that AppointmentsSource property is bound to ObservableCollection<IAppointment> while it should be ObservableCollection<Appointment> in order to work correctly.

I've attached a simple project based on your code, please download it and try it.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
David
Top achievements
Rank 1
answered on 15 Aug 2011, 01:56 AM
Hi,

Rather than using an arbitrarily-assigned Start and End time, how can I check the selected range the user has selected on the grid using his or her mouse and set default values like the Start date, End date and any Resources in the dialog window?
0
Valeri Hristov
Telerik team
answered on 15 Aug 2011, 11:56 AM
Hi David,

You could use the RadScheduleView.SelectedSlot property - it contains all needed information: Start, End, Resources and RecurrencePattern.

All the best,
Valeri Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Christian
Top achievements
Rank 1
answered on 25 Jun 2013, 02:41 PM
Is there any way to use the ObservableCollection<IAppointment> (interface) instead of ObservableCollection<Appointment> (implementation)?
I am using a custom appointment, and need to use its interface in order to decouple my application.
-- 
Sincerely, 
Christian
0
Yana
Telerik team
answered on 26 Jun 2013, 01:19 PM
Hi Christian,

If you're using ObservableCollection<IAppointment> for the AppointmentsSource of the ScheduleView, you will not be able to create new appointments with double-click on an empty slot ( as the ScheduleView does not know their type).

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
NickName
Top achievements
Rank 1
Answers by
Yana
Telerik team
NickName
Top achievements
Rank 1
David
Top achievements
Rank 1
Valeri Hristov
Telerik team
Christian
Top achievements
Rank 1
Share this question
or