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

Dosen't work with MVVM pattern?

1 Answer 157 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
samin
Top achievements
Rank 1
samin asked on 03 May 2011, 04:32 AM
Hi , I used mvvm pattern to prepere data for scheduler ... below you can see my sumrized code. when project start data loaded just today appointment load, when you change visible range ,data loaded truly and "Timeslices" property in "Schedule" updated , but doesn't show nothing.


public class Scheduler : INotifyPropertyChanged
   {
 
      ....
       private Schedule _timeSliceSchedule;
       public Schedule TimeSliceSchedule
       {
           get
           {
               return _timeSliceSchedule;
           }
           set
           {
               _timeSliceSchedule = value;
               OnPropertyChanged("TimeSliceScheduler");
           }
       }
 
       private bool _isGettingData;
       public bool IsGettingData
       {
           get
           {
               return _isGettingData;
           }
           set
           {
               _isGettingData = value;
               OnPropertyChanged("IsGettingData");
           }
       }
 
       private string _busyDescription;
      
       TimeSliceTypeCollection _timeSliceTypes = new TimeSliceTypeCollection();
       public TimeSliceTypeCollection TimeSliceTypes
       {
           get
           {
               return _timeSliceTypes;
           }
           set
           {
               _timeSliceTypes = value;
               OnPropertyChanged("TimeSliceTypes");
           }
       }
 
      ....
 
       #region INotifyPropertyChanged Members
 
       protected virtual void OnPropertyChanged(string propertyName)
       {
           if (PropertyChanged != null)
               PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
       }
       public event PropertyChangedEventHandler PropertyChanged;
       #endregion
   }


public class Schedule : ViewModelBase, INotifyPropertyChanged
    {
        
        
        ....
 
        private TimeSliceCollection timeSlices;
        public TimeSliceCollection TimeSlices
        {
            get
            {
                return this.timeSlices;
            }
            set
            {
                this.timeSlices = value;
                this.OnPropertyChanged("TimeSlices");
            }
        }
 
       ...
 
 
        #region # Events and Handler
 
        public delegate void VisibleRangeChangedHandler(DateTimeSpan datetimeSpan);
        public event VisibleRangeChangedHandler VisibleRangeChangedEvent;
 
        #endregion
 
        #region INotifyPropertyChanged Members
 
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion
    }


in View
<UserControl.Resources>
        <ViewModels:Scheduler x:Key="Scheduler" />
    </UserControl.Resources>
    <telerik:RadBusyIndicator Name="busyIndicator" IsBusy="{Binding Source=Scheduler, Path= IsGettingData}"  BusyContent="Please Wait..."  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0"    >
        <Grid x:Name="LayoutRoot" Background="White" DataContext="{StaticResource Scheduler}">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="250" />
            </Grid.ColumnDefinitions>
            <ViewControl:TimeSliceScheduleView x:Name="timeSliceScheduleView" DataContext="{Binding TimeSliceSchedule}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="0"/>
        </Grid>
    </telerik:RadBusyIndicator>



<Grid x:Name="LayoutRoot" Background="White" FlowDirection="RightToLeft">
        <Grid.RowDefinitions>
            <RowDefinition Height="35" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>
        <scheduleView:RadScheduleView Name="radSchedulerTimeSliceScheduleView" Grid.Row="1" Grid.Column="0"
                                 AppointmentsSource="{Binding TimeSlices,Mode=TwoWay}"
                                 VisibleRangeChangedCommand="{Binding VisibleRangeChanged}"
                                 VisibleRangeChangedCommandParameter="{Binding VisibleRange, RelativeSource={RelativeSource Self}}">
            <scheduleView:RadScheduleView.ViewDefinitions>
                <scheduleView:DayViewDefinition />
                <scheduleView:WeekViewDefinition />
                <scheduleView:MonthViewDefinition />
                <scheduleView:TimelineViewDefinition />
            </scheduleView:RadScheduleView.ViewDefinitions>
        </scheduleView:RadScheduleView>
    </Grid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 05 May 2011, 02:06 PM
Hello samin,

RadScheduleView is designed to work in MVVM scenarios, you can check our help article regarding this here.
If you still experience the issue, please send us a simple runnable project where it can be easily reproduced. Thanks in advance

Kind regards,
Yana
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
Tags
ScheduleView
Asked by
samin
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or