I would like to group using a int ID, but to display a string (or a more complete usercontrol!). Seems logic to me to ducplicate as group only an id instead of the wanted display string.
Any idea ? Template hack ?
Cordially,
Jean
4 Answers, 1 is accepted
You can use the style of the TimelineItemGroupControl type to achieve this result. For example, in case you just want to change the display string, you can specify it using the Header property and a converter:
<
Style
TargetType
=
"timelines:TimelineItemGroupControl"
BasedOn
=
"{StaticResource TimelineItemGroupControlStyle}"
>
<
Setter
Property
=
"Header"
Value
=
"{Binding DataItems, Converter={StaticResource headerTextConverter}}"
/>
</
Style
>
You can extract the business object from the first item in DataItems in the converter the following way:
MyBusinessType dataItem =
this
.DataItems.First().DataItem
as
MyBusinessType;
In case you want to change the header template, you can customize it using the HeaderTemplate property. For example:
<
Style
TargetType
=
"timelines:TimelineItemGroupControl"
BasedOn
=
"{StaticResource TimelineItemGroupControlStyle}"
>
<
Setter
Property
=
"HeaderTemplate"
>
<
Setter.Value
>
<
DataTemplate
>
<
Grid
Margin
=
"0,5,0,0"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Grid.Column
=
"0"
Text
=
"{Binding}"
Margin
=
"4 0 0 0"
HorizontalAlignment
=
"{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type timelines:TimelineItemGroupControl}}}"
></
TextBlock
>
<
Path
Grid.Column
=
"1"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Stretch"
Data
=
"M0,0 L800,0"
Height
=
"{StaticResource Timeline_TimelineItemGroup_Separator_Height}"
Margin
=
"5 1 0 0"
Stretch
=
"Fill"
Stroke
=
"{StaticResource Timeline_TimelineItemGroup_Separator_Stroke}"
/>
</
Grid
>
</
DataTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Header"
Value
=
"{Binding DataItems, Converter={StaticResource headerTextConverter}}"
/>
</
Style
>
For additional information on customizing the Styles of out controls, please refer to the following help topic - http://www.telerik.com/help/silverlight/styling-apperance-implicit-styles-overview.html.
Kind regards,
Tsvetie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I am using a custom version of Telerik.Windows.Controls.DataVisualization.xaml and I know my configuration is working because I was able to add a custom vertical ScrollViewer on the timeline in this same file.
But any changes I try to make in the TimelineItemGroupControl similar to those posted above have no effect. I have tried making changes to the included style, and even a hard-coded Header value has no effect:
<
Style
TargetType
=
"timelines:TimelineItemGroupControl"
BasedOn
=
"{StaticResource TimelineItemGroupControlStyle}"
>
<
Setter
Property
=
"Header"
Value
=
"This doesn't work!"
></
Setter
>
</
Style
>
Thanks,
Josh
Yes, you are correct - you cannot use the XAML solution that I posted before with Q3 2012. This is a result of a bugfix. I will log the problem that you have run into.
For the time being, you can use the same approach with the converter in the Template of the TimelineItemGroupControlStyle - simply change all TemplateBindings to the Header property with the new Binding expressing with converter.
Tsvetie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.