Hi,
i'm using the "Grouping and Filterung" Example of SchduleVIew. Ther you Add the ResourceTypesSource in xaml.
How do i add the Resources by code behind in this case?
XAML:
i'm using the "Grouping and Filterung" Example of SchduleVIew. Ther you Add the ResourceTypesSource in xaml.
How do i add the Resources by code behind in this case?
XAML:
<
scheduleView:RadScheduleView.ResourceTypesSource
>
<
scheduleView:ResourceTypeCollection
>
<
scheduleView:ResourceType
Name
=
"Category"
>
<
scheduleView:Resource
ResourceName
=
"Sven Ottlieb"
/>
<
scheduleView:Resource
ResourceName
=
"Martine Rance"
/>
<
scheduleView:Resource
ResourceName
=
"Howard Snyder"
/>
<
scheduleView:Resource
ResourceName
=
"Daniel Tonini"
/>
<
scheduleView:Resource
ResourceName
=
"John Steel"
/>
</
scheduleView:ResourceType
>
</
scheduleView:ResourceTypeCollection
>
</
scheduleView:RadScheduleView.ResourceTypesSource
>
Code Behind?
Thanks
Best Regrds
8 Answers, 1 is accepted
0
Hello,
Please review our help documentation for more details.
Regards,
Rosi
Telerik
Please review our help documentation for more details.
Regards,
Rosi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>
0
ITA
Top achievements
Rank 1
answered on 16 Aug 2013, 01:00 PM
hi,
i thanks i followed the online documentation! Now I create the Resources on MainWindow_Loaded Event. Is it possible
to create the Resources during loading the ViewModel?
thanks
Best Regards
i thanks i followed the online documentation! Now I create the Resources on MainWindow_Loaded Event. Is it possible
to create the Resources during loading the ViewModel?
thanks
Best Regards
0
ITA
Top achievements
Rank 1
answered on 18 Aug 2013, 02:43 PM
Hi,
I tried to follow up your online documentation, but I can't find any example where the ResourceTypeCollection is created
in code behind.
My ScheduleView:
I want to add this part in code behind:
Now I just do this:
Thanks a lot
Best Regads
Rene
I tried to follow up your online documentation, but I can't find any example where the ResourceTypeCollection is created
in code behind.
<
scheduleView:RadScheduleView.ResourceTypesSource
>
<
scheduleView:ResourceTypeCollection
>
<
scheduleView:ResourceType
Name
=
"HR"
>
<
local:EmployeeResource
ResourceName
=
"Mary Baird"
DisplayName
=
"MARY BAIRD"
Title
=
"Sales Associate"
City
=
"Seattle"
Photo
=
"../../Images/ScheduleView/CustomStyles/image1.png"
Brush
=
"#FF8EBC00"
/>
<
local:EmployeeResource
ResourceName
=
"Diego Roel"
DisplayName
=
"DIEGO ROEL"
Title
=
"Brand Manager"
City
=
"Seattle"
Photo
=
"../../Images/ScheduleView/CustomStyles/image2.png"
Brush
=
"#FF2F6495"
/>
<
local:EmployeeResource
ResourceName
=
"Grace Becerra"
DisplayName
=
"GRACE BECERRA"
Title
=
"Software Developer"
City
=
"Seattle"
Photo
=
"../../Images/ScheduleView/CustomStyles/image3.png"
Brush
=
"#FF7E51A1"
/>
</
scheduleView:ResourceType
>
</
scheduleView:ResourceTypeCollection
>
<
scheduleView:RadScheduleView.ResourceTypesSource
>
My ScheduleView:
<
scheduleView:RadScheduleView
AppointmentsSource
=
"{Binding Appointments}"
Grid.Column
=
"1"
Margin
=
"5"
ResourceTypesSource
=
"{Binding ResourceTypes}"
telerik:StyleManager.Theme
=
"Windows7"
TimeMarkersSource
=
"{Binding TimeMarkers}"
x:Name
=
"MyScheduleView"
GroupHeaderContentTemplateSelector
=
"{StaticResource GroupHeaderContentTemplateSelector}"
FirstDayOfWeek
=
"Monday"
FirstVisibleTime
=
"6:0:0"
ActiveViewDefinitionIndex
=
"1"
>
<
scheduleView:RadScheduleView.GroupDescriptionsSource
>
<
scheduleView:GroupDescriptionCollection
>
<
scheduleView:DateGroupDescription
/>
<
scheduleView:ResourceGroupDescription
ResourceType
=
"Gruppe"
/>
</
scheduleView:GroupDescriptionCollection
>
</
scheduleView:RadScheduleView.GroupDescriptionsSource
>
<
scheduleView:RadScheduleView.ViewDefinitions
>
<
scheduleView:DayViewDefinition
AppointmentFilter
=
"{Binding AppoitmentsFilter}"
GroupFilter
=
"{Binding GroupFilter}"
Orientation
=
"Vertical"
/>
<
scheduleView:WeekViewDefinition
AppointmentFilter
=
"{Binding AppoitmentsFilter}"
GroupFilter
=
"{Binding GroupFilter}"
Orientation
=
"Horizontal"
/>
<
scheduleView:MonthViewDefinition
AppointmentFilter
=
"{Binding AppoitmentsFilter}"
GroupFilter
=
"{Binding GroupFilter}"
/>
<
scheduleView:TimelineViewDefinition
AppointmentFilter
=
"{Binding AppoitmentsFilter}"
MinTimeRulerExtent
=
"16800"
/>
</
scheduleView:RadScheduleView.ViewDefinitions
>
</
scheduleView:RadScheduleView
>
I want to add this part in code behind:
<
local:HRResource
ResourceName
=
"Mary Baird"
DisplayName
=
"MARY BAIRD"
Photo
=
"../Images/ScheduleView/CustomStyles/image1.png"
Room
=
"411"
Brush
=
"#FF8EBC00"
/>
Now I just do this:
this.resourcesTVs = new List<
IResource
>
{
new Resource("User 1", "Gruppe"),
new Resource("User 2", "Gruppe"),
new Resource("User 3", "Gruppe"),
};
ResourceType resourceTypeTV = new ResourceType("Gruppe");
resourceTypeTV.Resources.AddRange(this.resourcesTVs);
Thanks a lot
Best Regads
Rene
0
Hi,
Please find the code that creates the collection below:
C#
Regards,
Rosi
Telerik
Please find the code that creates the collection below:
C#
ResourceType locationResource =
new
ResourceType(
"Location"
);
locationResource.Resources.Add(
new
Resource(
"Room 1"
));
locationResource.Resources.Add(
new
Resource(
"Room 2"
));
locationResource.Resources.Add(
new
Resource(
"Room 3"
));
this
.scheduleView.ResourceTypesSource =
new
ResourceTypeCollection
{
locationResource
};
Regards,
Rosi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>
0
ITA
Top achievements
Rank 1
answered on 19 Aug 2013, 06:39 AM
Hi,
this is what i do here:
But i would also add a brush and an Image like you do here:
Can't find an example how to solve this...
Thanks Best Regards
Rene
this is what i do here:
this.resourcesTVs = new List<
IResource
>
{
new Resource("User 1", "Gruppe"),
new Resource("User 2", "Gruppe"),
new Resource("User 3", "Gruppe"),
};
ResourceType resourceTypeProgramme = new ResourceType("Art");
resourceTypeProgramme.Resources.AddRange(this.resourcesProgrammes);
ResourceType resourceTypeTV = new ResourceType("Gruppe");
resourceTypeTV.Resources.AddRange(this.resourcesTVs);
But i would also add a brush and an Image like you do here:
<
local:HRResourceResourceName
=
"Mary Baird"
DisplayName
=
"MARY BAIRD"
Photo
=
"../Images/ScheduleView/CustomStyles/image1.png"
Room
=
"411"
Brush
=
"#FF8EBC00"
/>
Can't find an example how to solve this...
Thanks Best Regards
Rene
0
Hi Rene,
In order to achieve that you would need to create a custom resource class which inherits from our Resource class and a custom GroupHeaderContentTemplateSelector, you can find the exact approach described in the Templating the GroupHeaders article from our online help documentation. After that instead of setting the resources in XAML you can set them in code behind using the code snippet below:
Hope this will help you.
Regards,
Kalin
Telerik
In order to achieve that you would need to create a custom resource class which inherits from our Resource class and a custom GroupHeaderContentTemplateSelector, you can find the exact approach described in the Templating the GroupHeaders article from our online help documentation. After that instead of setting the resources in XAML you can set them in code behind using the code snippet below:
ResourceType locationResource =
new
ResourceType(
"Employee"
);
locationResource.Resources.Add(
new
EmployeeResource { DisplayName =
"Mary Baird"
,
Photo =
"Images/image1.jpg"
, Brush =
new
SolidColorBrush(Colors.Blue) });
locationResource.Resources.Add(
new
EmployeeResource { DisplayName =
"Diego Roel"
,
Photo =
"Images/image2.jpg"
, Brush =
new
SolidColorBrush(Colors.Red) });
locationResource.Resources.Add(
new
EmployeeResource { DisplayName =
"Grace Becerra"
,
Photo =
"Images/image3.jpg"
, Brush =
new
SolidColorBrush(Colors.Green) });
this
.scheduleView.ResourceTypesSource =
new
ResourceTypeCollection
{
locationResource
};
GroupDescriptionCollection groupDescription =
new
GroupDescriptionCollection
{
new
DateGroupDescription(),
new
ResourceGroupDescription{ ResourceType =
"Employee"
}
};
this
.scheduleView.GroupDescriptionsSource = groupDescription;
Hope this will help you.
Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>
0
ITA
Top achievements
Rank 1
answered on 21 Aug 2013, 05:15 PM
Hi,
thanks a lot this is it! Works great, perfect. One last question:
Is it possible to check if a Resource ist still existing? Now I add the Resource items out of a File
Is it possible here to check if this Resource (ResourceName) is already in MyList?
Thanks
Best Regards
Rene
thanks a lot this is it! Works great, perfect. One last question:
Is it possible to check if a Resource ist still existing? Now I add the Resource items out of a File
MyList.Add(new GroupHaderResource { DisplayName = splitline[0], ResourceType = "Gruppe", Fullname = splitline[3], name = splitline[1], ResourceName = splitline[2] });
Is it possible here to check if this Resource (ResourceName) is already in MyList?
Thanks
Best Regards
Rene
0
Hi Rene,
If you need to check whether the resource is existing you can easily do it inside an "if" statement and add the resource if not present in the resources collection. Please see the example code snippet below:
Hope this helps.
Regards,
Kalin
Telerik
If you need to check whether the resource is existing you can easily do it inside an "if" statement and add the resource if not present in the resources collection. Please see the example code snippet below:
if
(!MyList.Any(x => x.ResourceName == splitline[2]))
{
// here you add the resource to the collection
}
Hope this helps.
Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>