I don't remember where I got it, but I have some code:
Dim
ColumnSeries
As
New
Telerik.Windows.Controls.ChartView.BarSeries
ColumnSeries.PointTemplate = TryCast(Application.Current.TryFindResource(
"ColumnDataPointTemplate"
), DataTemplate)
And in a resource dictionary:
<
DataTemplate
x:Key
=
"ColumnDataPointTemplate"
>
<
Rectangle
Fill
=
"{Binding Brush}"
MaxWidth
=
"40"
/>
</
DataTemplate
>
It works fine for the Bar series but fails to display anything if I use the same resource for the point template of a RangeBarSeries. I found somewhere in a forum post I think to use DefaultVisualStyle and that does work to set the max width, BUT it does not center the bar on the category label tick.
<
Style
x:Key
=
"RangeBarVisualStyle"
TargetType
=
"Border"
>
<
Setter
Property
=
"Background"
Value
=
"{Binding Brush}"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"0"
/>
<
Setter
Property
=
"MaxWidth"
Value
=
"40"
/>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Center"
/>
</
Style
>
It does the same thing if I use the visual style on the regular bar so I know it is not specific to the range bar.
In the attached picture, I am showing the bars with no point template or default visual style. The second is with a point template, and the last is with the default visual style.
I would like to make either of these work... I don't really care which one.