XAML-SDK Reminders example little bug

3 posts, 0 answers
  1. Richard
    Richard  avatar
    14 posts
    Member since:
    Jun 2013

    Posted 24 Aug Link to this post

    For what it worth, playing around with the reminders example I found that it wouldn't open the appointment for edition when the "Open Item"  button is clicked.

    I checked the git repository to see if this is already addressed, but the last update to this files is about 4 years old, so here is the trick:

     

    It turns out that at the time where the scheduleview reference is passed to the ReminderViewModel constructor (via the ViewModel class constructor), it is null.

    So I added a ScheduleView property to ViewModel as a fachade for the reminder's view model property:

            public RadScheduleView ScheduleView
            {
                get { return reminderViewModel.ScheduleView; }
                set { reminderViewModel.ScheduleView = value; }
            }

    and set it again once the IntializeComponent() method is called in the Example window's constructor:

            public Example()
            {
                viewModel = new ViewModel(this.scheduleView);
                this.DataContext = viewModel;
                InitializeComponent();
                viewModel.ScheduleView = this.scheduleView;
            }

    And presto! Now it works as expected.

     

    Best regards.

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1408 posts

    Posted 29 Aug Link to this post

    Hello Richard,

    Thank you for pointing this issue. Based on your feedback be fixed it and the fix will be live on GitHub pretty soon. I also updated your Telerik points as a small gratitude for reporting this. 

    Just for your information, the 'scheduleView' was null because it is get before the InitializeComponent() method is called. To resolve this you can just move the ViewModel creating just after InitializeComponent().
    public Example()
    {  
        InitializeComponent();
        viewModel = new ViewModel(this.scheduleView);
        this.DataContext = viewModel;
    }

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Richard
    Richard  avatar
    14 posts
    Member since:
    Jun 2013

    Posted 30 Aug Link to this post

    Thanks martin.

    I am obviously influenced by the fact that usually I do some stuff *before* setting the view model...  Usually, I DO need the view model before initializing components because they already carry some significant info to show...

    Maybe that is a call to review desing style... hmmm...

    Best regards.

Back to Top