Hello,
I am using scheduleView. I need to create resourcetypes and resources in code behind means dynamically. How can i do that ? also after insert/update/remove resourcetypes/resources, how can i refresh scheduleview to take effect ?
kindly answer asap.
thank you
regards
I am using scheduleView. I need to create resourcetypes and resources in code behind means dynamically. How can i do that ? also after insert/update/remove resourcetypes/resources, how can i refresh scheduleview to take effect ?
kindly answer asap.
thank you
regards
5 Answers, 1 is accepted
0
Hello Palak,
You can add/remove resource types to the ResourceTypeSource collection of RadScheduleView. In this case the scheduleview will refresh himself.
When you add/remove resources to the ResourceTypes you should also remove/add the resourceType to the
ResourceTypeSource. This will refresh the view again.
Example:
var resource1 = new Resource("Room1");
var resource2 = new Resource("Room2");
var resource3 = new Resource("Room3");
var resourceType = new ResourceType("Room");
resourceType.Resources.Add(resource1);
resourceType.Resources.Add(resource2);
resourceType.Resources.Add(resource3);
var resourceTypes = new List<ResourceType>();
resourceTypes.Add(resourceType);
scheduleView.ResourceTypesSource = resourceTypes;
All the best,
Rosi
the Telerik team
You can add/remove resource types to the ResourceTypeSource collection of RadScheduleView. In this case the scheduleview will refresh himself.
When you add/remove resources to the ResourceTypes you should also remove/add the resourceType to the
ResourceTypeSource. This will refresh the view again.
Example:
var resource1 = new Resource("Room1");
var resource2 = new Resource("Room2");
var resource3 = new Resource("Room3");
var resourceType = new ResourceType("Room");
resourceType.Resources.Add(resource1);
resourceType.Resources.Add(resource2);
resourceType.Resources.Add(resource3);
var resourceTypes = new List<ResourceType>();
resourceTypes.Add(resourceType);
scheduleView.ResourceTypesSource = resourceTypes;
All the best,
Rosi
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
palak
Top achievements
Rank 1
answered on 07 Jun 2011, 09:50 AM
Thanks . actually i made custom RoomResources(resource) & RoomResourceTypes(resourcetype) class. below code not working.
In ScheduleView.Xaml.cs,
GradientStop gs1 =
new
GradientStop();
gs1.Color = Color.FromArgb(255, 0, 255, 0);
gs1.Offset = 0;
GradientStop gs2 =
new
GradientStop();
gs2.Color = Color.FromArgb(255, 0, 0, 255);
gs2.Offset = 1;
LinearGradientBrush resourceBrush =
new
LinearGradientBrush();
resourceBrush.GradientStops.Add(gs1);
resourceBrush.GradientStops.Add(gs2);
resourceBrush.StartPoint =
new
Point(0.5, 0);
resourceBrush.EndPoint =
new
Point(0.5, 1);
//p.Fill = resourceBrush;
RoomResources myResource =
new
RoomResources();
myResource.Name =
"Room One"
;
myResource.Brush = resourceBrush;
RoomResources myResourceTwo =
new
RoomResources();
myResourceTwo.Name =
"Room Two"
;
myResourceTwo.Brush = resourceBrush;
RoomResourceTypes myResourceType =
new
RoomResourceTypes();
myResourceType.ResourceTypeName =
"Rooms"
;
myResourceType.Resources.Add(myResource);
myResourceType.Resources.Add(myResourceTwo);
List<RoomResourceTypes> resourceTypes =
new
List<RoomResourceTypes>();
resourceTypes.Add(myResourceType);
SchedulerView.ResourceTypesSource = resourceTypes;
in SchedulerView.Xaml
<telerik:RadScheduleView x:Name=
"SchedulerView"
Grid.Column=
"0"
Grid.Row=
"1"
TimeRulerItemTemplateSelector=
"{x:Null}"
TimeRulerItemStyleSelector=
"{StaticResource TimeRulerItemStyleSelector}"
telerik:StyleManager.Theme=
"Windows7"
GroupHeaderContentTemplateSelector=
"{StaticResource GroupHeaderContentTemplateSelector}"
Loaded=
"SchedulerView_Loaded"
AppointmentCreating=
"SchedulerView_AppointmentCreating"
AppointmentDeleting=
"SchedulerView_AppointmentDeleting"
AppointmentDeleted=
"SchedulerView_AppointmentDeleted"
AppointmentEdited=
"SchedulerView_AppointmentEdited"
AppointmentSaving=
"SchedulerView_AppointmentSaving"
>
<telerik:RadScheduleView.GroupDescriptionsSource>
<telerik:GroupDescriptionCollection>
<telerik:ResourceGroupDescription ResourceType=
"Rooms"
/>
</telerik:GroupDescriptionCollection>
</telerik:RadScheduleView.GroupDescriptionsSource>
<telerik:RadScheduleView.ViewDefinitions>
<telerik:DayViewDefinition TimerulerMajorTickStringFormat=
"{}{0:%H}:{0:%m} "
GroupHeaderDateStringFormat=
"{}{0:dddd(MM.dd.yyyy)}"
MinorTickLength=
"1h"
MajorTickLength=
"1d"
MinTimeRulerExtent=
"3000"
/>
<telerik:WeekViewDefinition MinorTickLength=
"1h"
MajorTickLength=
"1d"
TimerulerMajorTickStringFormat=
"{}{0:h tt}:{0:mm} "
TimerulerMinorTickStringFormat=
":{0:mm} "
GroupHeaderDateStringFormat=
"{}{0:dddd(MM/dd)}"
MinTimeRulerExtent=
"3000"
/>
<telerik:MonthViewDefinition TimerulerGroupStringFormat=
"< {0:dddd} >"
TimerulerMajorTickStringFormat=
"{}{0:%M}.{0:%d}"
GroupHeaderDateStringFormat=
"{}{0:MM/dd}"
/>
<telerik:TimelineViewDefinition TimerulerGroupStringFormat=
"{}{0:dd.MM.yyyy}"
TimerulerMajorTickStringFormat=
"{}{0:%H}"
TimerulerMinorTickStringFormat=
":{0:%m}"
MajorTickLength=
"1h"
MinorTickLength=
"10min"
MinTimeRulerExtent=
"15000"
/>
</telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
Kindly check & reply what is the problem with this.
Also give me some extra inforation about below points.
1)What is actually needed to show resources in scheduleView , And what is needed to show resources in ScheduleView Edit Dialog Window ?
2) when we add resources , it shows in DropDown control in Edit Dialog Window, can i add another type of control like textbox, checkbox etc.
thanks & regards
0
Satyendra
Top achievements
Rank 1
answered on 07 Jun 2011, 01:22 PM
You will have to get EditAppointmentDialogStyle source code from RadScheduleView template using Expression Blend and edit its EditAppointmentTemplate to add control like TextBox, CheckBox or ComobBox. Here I added combobox in Appointment Dialog box http://www.telerik.com/community/forums/silverlight/scheduleview/add-combobox-in-appointmentdialog.aspx
0
palak
Top achievements
Rank 1
answered on 08 Jun 2011, 09:09 AM
thnx satyendra,
actually i am using vs 2010 not blend , so can't do on that way. yes i know abt ediappointmentdialogstyle, i used it when i needed custom properties in edit appointment dialog.
see, my problem is , i am assigning appointments dynamically to scheduleview, also i am creating resourcetypes/resources dynamically. Now i want to know how can i assign specific resource to particular resourcetype of scheduleview in code-behind.
check below.
please suggest or show how to do CRUD operations when resources/resourcetypes dynamically added.
thanks & regards
actually i am using vs 2010 not blend , so can't do on that way. yes i know abt ediappointmentdialogstyle, i used it when i needed custom properties in edit appointment dialog.
see, my problem is , i am assigning appointments dynamically to scheduleview, also i am creating resourcetypes/resources dynamically. Now i want to know how can i assign specific resource to particular resourcetype of scheduleview in code-behind.
check below.
ResourceAppointment newAppointment = e.Appointment as ResourceAppointment;
listItem["Title"] = newAppointment.Subject.ToString();
listItem["EventDate"] = Convert.ToDateTime(newAppointment.Start).ToLocalTime();
listItem["EndDate"] = Convert.ToDateTime(newAppointment.End).ToLocalTime();
listItem["Description"] = newAppointment.Body.ToString();
//here i want to assign selected resource from dropdown to listitem but don't know how ?
listItem["Rooms"] = ??
listItem["Resources"] = ??
please suggest or show how to do CRUD operations when resources/resourcetypes dynamically added.
thanks & regards
0
palak
Top achievements
Rank 1
answered on 09 Jun 2011, 08:39 AM
guys,
have you got anything regarding my problem ?
have you got anything regarding my problem ?