Show AppointmentDialogWindow manually

9 posts, 1 answers
  1. NickName
    NickName avatar
    14 posts
    Member since:
    Nov 2010

    Posted 01 Aug 2011 Link to this post

    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.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. NickName
    NickName avatar
    14 posts
    Member since:
    Nov 2010

    Posted 01 Aug 2011 Link to this post

    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>
  5. NickName
    NickName avatar
    14 posts
    Member since:
    Nov 2010

    Posted 02 Aug 2011 Link to this post

    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.
  6. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Aug 2011 Link to this post

    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 >>

  7. David
    David avatar
    2 posts
    Member since:
    Oct 2012

    Posted 14 Aug 2011 Link to this post

    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?
  8. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 15 Aug 2011 Link to this post

    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 >>

  9. Christian
    Christian avatar
    3 posts
    Member since:
    Jun 2012

    Posted 25 Jun 2013 Link to this post

    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
  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 26 Jun 2013 Link to this post

    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 >>
Back to Top
DevCraft banner