Hi Support,
I tried using appointmentstyle selector as mentioned on telerik site and i tried to set the visibility property of appointmentitem;
but I am getting error as 'Xaml Parse exception : Line 0 Position 0'.
Here is the code for your reference.
I tried using appointmentstyle selector as mentioned on telerik site and i tried to set the visibility property of appointmentitem;
but I am getting error as 'Xaml Parse exception : Line 0 Position 0'.
Here is the code for your reference.
<
Style x:Key="AppointmentTypeStyle" TargetType="telerik:AppointmentItem">
<Setter Property="Visibility" Value="Visible"></Setter>
</Style>
<
local:AppointmentStyleSelector x:Key="ItemStyleSelector"
AppointmentTypeStyle
="{StaticResource AppointmentTypeStyle}" />
Thanks
Prachi
3 Answers, 1 is accepted
0
Hello Prachi,
From the code you have posted we can conclude that you should have no problems using the selector. Please, send us a reproducable sample, so that we can find out what has gone wrong.
As a side note, I would like to point out that it is not recommended that you use the Visibility property as a part of an appointment style. Switching between different Visibility values for the appointments might result in improper recycling and unexpected rendering of the appointment items.
Greetings,
Dani
the Telerik team
From the code you have posted we can conclude that you should have no problems using the selector. Please, send us a reproducable sample, so that we can find out what has gone wrong.
As a side note, I would like to point out that it is not recommended that you use the Visibility property as a part of an appointment style. Switching between different Visibility values for the appointments might result in improper recycling and unexpected rendering of the appointment items.
Greetings,
Dani
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

Prachi
Top achievements
Rank 1
answered on 27 May 2011, 10:23 AM
Hi telerik ,
Here my requirement is to show those appointments for which resources are checked. Can you suggest me the peoper way to it.
And I am also grouping resources in two groups and trying to show child resources per group by setting the visibility property. but some times it does not display it properly. Please give me solution for the same.
Here I am attaching the code for resource grouping
XAML Code :
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"DateGroup"
>
<
TextBlock
Text
=
"{Binding}"
Width
=
"70"
></
TextBlock
>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"ResourceGroup"
>
<
CheckBox
x:Name
=
"resourceCheckBox"
Content
=
"{Binding}"
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"Checked"
>
<
hms:EventToCommand
Command
=
"{Binding ResourceCheckedCommand, Source={StaticResource ViewModel}}"
CommandParameter
=
"{Binding ElementName=resourceCheckBox}"
PassEventArgsToCommand
=
"True"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
</
CheckBox
>
</
DataTemplate
>
<
Style
x:Key
=
"AppointmentTypeTemplate"
TargetType
=
"telerik:GroupHeader"
>
<
Style.BasedOn
>
<
Style
TargetType
=
"telerik:GroupHeader"
>
<
Setter
Property
=
"Visibility"
Value
=
"Visible"
></
Setter
>
</
Style
>
</
Style.BasedOn
>
</
Style
>
<
Style
x:Key
=
"VisibleResourceTypeTemplate"
TargetType
=
"telerik:GroupHeader"
>
<
Style.BasedOn
>
<
Style
TargetType
=
"telerik:GroupHeader"
>
<
Setter
Property
=
"Visibility"
Value
=
"Visible"
></
Setter
>
</
Style
>
</
Style.BasedOn
>
</
Style
>
<
Style
x:Key
=
"HiddenResourceTypeTemplate"
TargetType
=
"telerik:GroupHeader"
>
<
Style.BasedOn
>
<
Style
TargetType
=
"telerik:GroupHeader"
>
<
Setter
Property
=
"Visibility"
Value
=
"Collapsed"
></
Setter
>
</
Style
>
</
Style.BasedOn
>
</
Style
>
<
local:GroupHeaderContentTemplateSelector
x:Key
=
"ItemSelector"
DateGroup
=
"{StaticResource DateGroup}"
ResourceGroup
=
"{StaticResource ResourceGroup}"
/>
<
local:GroupHeaderStyleSelector
x:Key
=
"ItemStyleSelector"
AppointmentTypeTemplate
=
"{StaticResource AppointmentTypeTemplate}"
HiddenResourceTypeTemplate
=
"{StaticResource HiddenResourceTypeTemplate}"
VisibleResourceTypeTemplate
=
"{StaticResource VisibleResourceTypeTemplate}"
/>
</
UserControl.Resources
>
<
r:RadScheduleView
Name
=
"appointmentview"
MaxWidth
=
"1000"
Height
=
"500"
AppointmentsSource
=
"{Binding Path=ScheduledAppointment}"
CurrentDate
=
"{Binding Path= SelectedSlot.Start,Mode=TwoWay}"
ResourceTypesSource
=
"{Binding Path= ListResourceTypes}"
GroupHeaderContentTemplateSelector
=
"{StaticResource ItemSelector}"
GroupHeaderStyleSelector
=
"{StaticResource ItemStyleSelector}"
SelectedSlot
=
"{Binding Path=SelectedSlot,Mode=TwoWay}"
>
<
r:RadScheduleView.ViewDefinitions
>
<
r:DayViewDefinition
Orientation
=
"Horizontal"
DayStartTime
=
"{Binding Path=StartTimeOfScheduleView}"
DayEndTime
=
"{Binding Path= EndTimeOfScheduleView,Mode=TwoWay}"
MinorTickLength
=
"{Binding Path=MinTickLength, Mode=TwoWay}"
MajorTickLength
=
"{Binding Path=MaxTickLength, Mode=TwoWay}"
/>
</
r:RadScheduleView.ViewDefinitions
>
<
r:RadScheduleView.GroupDescriptionsSource
>
<
r:GroupDescriptionCollection
>
<
r:DateGroupDescription
/>
<
r:ResourceGroupDescription
ResourceType
=
"AppointmentType"
/>
<
r:ResourceGroupDescription
ResourceType
=
"ResourceType"
/>
</
r:GroupDescriptionCollection
>
</
r:RadScheduleView.GroupDescriptionsSource
>
</
r:RadScheduleView
>
code in .cs file
public
class
GroupHeaderContentTemplateSelector : ScheduleViewDataTemplateSelector
{
public
DataTemplate DateGroup {
get
;
set
; }
public
DataTemplate ResourceGroup {
get
;
set
; }
public
override
DataTemplate SelectTemplate(
object
item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
{
if
(item.GetType() ==
typeof
(System.DateTime))
return
DateGroup;
else
return
ResourceGroup;
}
}
public
class
GroupHeaderStyleSelector : ScheduleViewStyleSelector
{
public
Style AppointmentTypeTemplate {
get
;
set
; }
public
Style VisibleResourceTypeTemplate {
get
;
set
; }
public
Style HiddenResourceTypeTemplate {
get
;
set
; }
public
override
Style SelectStyle(
object
item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
{
var containerObj = container
as
GroupHeader;
if
(containerObj.GroupKey.GetType() ==
typeof
(System.DateTime))
return
base
.SelectStyle(item, container, activeViewDeifinition);
else
{
if
(containerObj.GroupKey.GetType()==
typeof
(Telerik.Windows.Controls.Resource))
{
var resourceScheduleView = containerObj.GroupKey
as
Telerik.Windows.Controls.Resource;
if
(resourceScheduleView.ResourceType ==
"AppointmentType"
)
return
AppointmentTypeTemplate;
else
{
if
(resourceScheduleView.ResourceType ==
"ResourceType"
)
{
var parentResource = containerObj.ParentKeys
as
List<
object
>;
if
(parentResource[0].GetType() ==
typeof
(Telerik.Windows.Controls.Resource))
{
// Here always second last parent will be the appointmenttype
var parentResourType = parentResource[1]
as
Telerik.Windows.Controls.Resource;
int
position = resourceScheduleView.ResourceName.IndexOf(
'-'
);
var parentId = resourceScheduleView.ResourceName.Substring(position+1);
if
(parentId == parentResourType.ResourceName)
return
VisibleResourceTypeTemplate;
else
return
HiddenResourceTypeTemplate;
}
else
return
base
.SelectStyle(item, container, activeViewDeifinition);
}
else
return
base
.SelectStyle(item, container, activeViewDeifinition);
}
}
else
return
base
.SelectStyle(item,container,activeViewDeifinition);
}
}
}
public
class
AppointmentStyleSelector : ScheduleViewStyleSelector
{
public
Style AppointmentStyle {
get
;
set
; }
public
Style CheckedResource {
get
;
set
; }
public
override
Style SelectStyle(
object
item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
{
//var occurence = item as Occurrence;
//if (occurence == null) return null;
var appointmentItem = item
as
ScheduleViewAppointment;
if
(item ==
null
)
return
base
.SelectStyle(item,container,activeViewDeifinition);
if
(!(appointmentItem.IsVisible))
return
base
.SelectStyle(item, container, activeViewDeifinition);
else
return
base
.SelectStyle(item, container, activeViewDeifinition);
}
}
0
Hi Prachi,
Thank you for the supplied sources. However, display of a certain group or resource upon checking a CheckBox in a resource header is not possible with the current implementation of RadScheduleView, I am afraid.
Regards,
Dani
the Telerik team
Thank you for the supplied sources. However, display of a certain group or resource upon checking a CheckBox in a resource header is not possible with the current implementation of RadScheduleView, I am afraid.
Regards,
Dani
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