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

Refresh ScheduleView after adding resources in code behind

5 Answers 248 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 17 May 2011, 11:34 AM
Hello,

I'm evaluating this control to look if it fills my needs, because I'm building an application where I need a schedule component.

In code behind i'm adding resources to a ResourceType in my ResourceTypeCollection, but the new resource is not displayed in the ScheduleView. When I navigate to another day then the new Resource appears.

   ResourceType.Resources.Add(new Resource { ResourceName = "Phil Collins" });

Now I tried the following and this works, but I can't imagine that this is a proper way to make it work.

   ResourceType.Resources.Add(new Resource { ResourceName = "Phil Collins" });
   ResourceTypeCollection.Remove(ResourceType);
   ResourceTypeCollection.Add(ResourceType);

ResourceTypeCollection is an ObservableCollection<ResourceType>() and when I Add or Remove a Resource the ScheduleView is updated, but isn't there a way to update the ScheduleView when I just add Resources without removing / adding ResourceTypes from / to the ResourceTypeCollection?

Thanks in advance!

Best regards,
Jeffrey

5 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 20 May 2011, 10:10 AM
Hi Jeffrey,

You are correct, this is the right way to add resources to a resource type at runtime. We intentionally do not listen for changes in the Resources collection of a ResourceType (actually all of its properties) because of performance considerations, as we will have to reset the whole RadScheduleView once a Resource is added, and if you are adding many resources, we will have to do a reset every time.

Best wishes,
Valeri Hristov
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
0
Dan
Top achievements
Rank 1
answered on 29 Jun 2012, 02:32 PM
This solution does not cause the ScheduleView to refresh the resources.  i'm using a usercontrol to style the resource headers and they are not refreshing when the ResourceTypeCollection is set or when an item in the collection is changed. my solution involves creating a new instance of the control, but this is not an option in all instances.
0
Yana
Telerik team
answered on 04 Jul 2012, 07:22 AM
Hello,

We've prepared a help topic which explains in more details how you can update the resources at runtime. You can check it at the following link:
http://www.telerik.com/help/silverlight/radscheduleview-howto-update-resources.html

If you still have any issues, please contact us again.

Greetings,
Yana
the Telerik team

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

0
Håkan
Top achievements
Rank 1
answered on 26 Feb 2013, 01:34 PM
Hi,

Regarding performance, what is the best method to use of the two described in the link abowe?

I use the remove/add of the resource type but it is taking a couple of seconds for me, when I have 200+ resources with 600+ appointments.
Would I gain anything by implementing the group filter instead?

Regards,
Håkan
0
Yana
Telerik team
answered on 01 Mar 2013, 02:05 PM
Hi Håkan,

I guess that implementing Group Filter should be faster, but it depends on the specific case as well.  I have attached a sample project with 200 resources and group filter, so you could check whether this solution is suitable for your case.


Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ScheduleView
Asked by
Jeffrey
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Dan
Top achievements
Rank 1
Yana
Telerik team
Håkan
Top achievements
Rank 1
Share this question
or