This question is locked. New answers and comments are not allowed.
The RadCartesianChart control (or its axes) sometimes causes this exception (The property 'LabelStyle' was not found in type 'Telerik.Windows.Controls.Charting.Axis'.) or a similar exception (The property 'MajorTickStyle' was not found in type 'Telerik.Windows.Controls.Charting.Axis'.) to be thrown.
The strange thing is that it seems to happen randomly. Simply reloading the webpage (i.e. reloading the Silverlight plugin) usually fixes the problem.
I've tried setting these properties in several ways, both in xaml and code-behind. When in xaml, the exception is thrown during the InitializeComponent() of the page. When in code-behind, it's thrown at startup of the application.
I've not been able to reproduce it in a new project with a RadCartesianChart. Maybe the size of the project has something to do with it?
Currently I'm adding the axes in code-behind like this (in the Loaded event of the chart):
The styles are defines as follows:
Any help much appreciated.
The strange thing is that it seems to happen randomly. Simply reloading the webpage (i.e. reloading the Silverlight plugin) usually fixes the problem.
I've tried setting these properties in several ways, both in xaml and code-behind. When in xaml, the exception is thrown during the InitializeComponent() of the page. When in code-behind, it's thrown at startup of the application.
I've not been able to reproduce it in a new project with a RadCartesianChart. Maybe the size of the project has something to do with it?
Currently I'm adding the axes in code-behind like this (in the Loaded event of the chart):
LinearAxis verticalAxis =
new
LinearAxis()
{
Title =
""
,
Name =
"MyVerticalAxis"
,
Style = App.Current.Resources[
"ChartCustomAxis"
]
as
Style,
LabelStyle = App.Current.Resources[
"ChartLabel"
]
as
Style
};
ChartJam.VerticalAxis = verticalAxis;
DateTimeContinuousAxis horizontalAxis =
new
DateTimeContinuousAxis()
{
Title =
""
,
Name =
"MyHorizontalAxis"
,
PlotMode = Telerik.Charting.AxisPlotMode.OnTicks,
Style = App.Current.Resources[
"ChartCustomAxis"
]
as
Style,
LabelStyle = App.Current.Resources[
"ChartLabel"
]
as
Style,
LabelFitMode = Telerik.Charting.AxisLabelFitMode.Rotate
};
ChartJam.HorizontalAxis = horizontalAxis;
The styles are defines as follows:
<
Style
x:Key
=
"ChartCustomAxis"
TargetType
=
"telerik:Axis"
>
<
Setter
Property
=
"MajorTickStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"Rectangle"
>
<
Setter
Property
=
"Fill"
Value
=
"#FFD7D7D7"
/>
<
Setter
Property
=
"Opacity"
Value
=
"0.3"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
</
Style
>
<
Style
x:Key
=
"ChartLabel"
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"Foreground"
Value
=
"White"
/>
<
Setter
Property
=
"Margin"
Value
=
"1"
/>
</
Style
>
Any help much appreciated.
10 Answers, 1 is accepted
0
Jeroen
Top achievements
Rank 1
answered on 19 Apr 2012, 10:19 AM
Even when I remove all charts from the project, the problem still occurs randomly (at startup) when I have the following code in one of the project's general ResourceDictionaries:
How is this possible?
... xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" ...
...
<
Style
x:Key
=
"ChartCustomAxis"
TargetType
=
"telerik:Axis"
>
<
Setter
Property
=
"MajorTickStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"Rectangle"
>
<
Setter
Property
=
"Fill"
Value
=
"#FFD7D7D7"
/>
<
Setter
Property
=
"Opacity"
Value
=
"0.3"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
</
Style
>
How is this possible?
0
Hi Jeroen,
We are sorry to hear that you are experiencing problems with our controls. We know that randomly-occuring errors are the most annoying of all.
In this particular situation I have a hunch why this is happening. Currently we have two chart controls: RadChart (assembly Telerik.Controls.Charting) and RadChartView (assembly Telerik.Controls.Chart). Both of these assemblies have an Axis class. I guess that you have added both of the references to your project and this is the origins of the problem.
1. I would suggest that you don't add both of these dlls. This should fix the problem.
2. If you need both of these assemblies - I can suggest that you do not use the Telerik schema:
but use the full name of the clr-namespace:
for RadChart and:
for the RadChartView.
I apologize for all caused inconvenience. Let us know if this fixes the currently present issues.
Kind regards,
Petar Marchev
the Telerik team
We are sorry to hear that you are experiencing problems with our controls. We know that randomly-occuring errors are the most annoying of all.
In this particular situation I have a hunch why this is happening. Currently we have two chart controls: RadChart (assembly Telerik.Controls.Charting) and RadChartView (assembly Telerik.Controls.Chart). Both of these assemblies have an Axis class. I guess that you have added both of the references to your project and this is the origins of the problem.
1. I would suggest that you don't add both of these dlls. This should fix the problem.
2. If you need both of these assemblies - I can suggest that you do not use the Telerik schema:
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
<
UserControl
xmlns:radcharting
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
xmlns:charting
=
"clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
/>
<
UserControl
xmlns:radchartview
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartview
=
"clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"
/>
I apologize for all caused inconvenience. Let us know if this fixes the currently present issues.
Kind regards,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jeroen
Top achievements
Rank 1
answered on 10 May 2012, 01:24 PM
I've tried your 2nd suggestion and it seems to work fine now. Thanks!
0
Jeroen
Top achievements
Rank 1
answered on 29 May 2012, 03:09 PM
Unfortunately today I've encountered a problem again, in a version of my application where I've implemented the "fix". Again the error only happens sometimes. Usually simply reloading the webpage fixes the issue.
The exception now thrown is: Could not load file or assembly 'Telerik.Windows.Controls.Chart, Version=2012.1.326.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest. (Exception from HRESULT: 0x80131053)
In the xaml the only namespaces referenced are:
The chart:
The exception now thrown is: Could not load file or assembly 'Telerik.Windows.Controls.Chart, Version=2012.1.326.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest. (Exception from HRESULT: 0x80131053)
In the xaml the only namespaces referenced are:
xmlns:radchartview="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartview="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"The chart:
<
Border
Margin
=
"2,2,8,2"
Grid.Column
=
"0"
Background
=
"#33000000"
>
<
Border.Resources
>
<
Style
x:Key
=
"CustomAxis"
TargetType
=
"chartview:Axis"
>
<
Setter
Property
=
"LabelStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"Margin"
Value
=
"1"
/>
<
Setter
Property
=
"Foreground"
Value
=
"White"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"MajorTickStyle"
>
<
Setter.Value
>
<
Style
TargetType
=
"Rectangle"
>
<
Setter
Property
=
"Fill"
Value
=
"#FFD7D7D7"
/>
<
Setter
Property
=
"Opacity"
Value
=
"0.3"
/>
</
Style
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Border.Resources
>
<
radchartview:RadCartesianChart
x:Name
=
"ChartJam"
MouseWheel
=
"ChartJam_MouseWheel"
MouseLeftButtonUp
=
"ChartJam_MouseLeftButton"
Loaded
=
"ChartJam_Loaded"
Height
=
"Auto"
MinHeight
=
"100"
Width
=
"Auto"
MinWidth
=
"200"
>
<
radchartview:RadCartesianChart.VerticalAxis
>
<
chartview:LinearAxis
Title
=
""
Style
=
"{StaticResource CustomAxis}"
/>
</
radchartview:RadCartesianChart.VerticalAxis
>
<
radchartview:RadCartesianChart.HorizontalAxis
>
<
chartview:DateTimeContinuousAxis
PlotMode
=
"OnTicks"
Style
=
"{StaticResource CustomAxis}"
MajorStepUnit
=
"{Binding MajorStepUnit}"
MajorStep
=
"{Binding MajorStep}"
LabelFormat
=
"{Binding LabelFormat}"
Minimum
=
"{Binding MinimumDateTime}"
LabelFitMode
=
"Rotate"
Title
=
""
/>
</
radchartview:RadCartesianChart.HorizontalAxis
>
<
radchartview:RadCartesianChart.Behaviors
>
<
chartview:ChartPanAndZoomBehavior
ZoomMode
=
"None"
PanMode
=
"None"
/>
<
chartview:ChartTrackBallBehavior
ShowIntersectionPoints
=
"True"
ShowTrackInfo
=
"True"
SnapMode
=
"ClosestPoint"
/>
</
radchartview:RadCartesianChart.Behaviors
>
<
chartview:AreaSeries
ItemsSource
=
"{Binding LineData}"
CategoryBinding
=
"DtJamLength"
ValueBinding
=
"JamLength"
StrokeThickness
=
"1"
Stroke
=
"#FF93D427"
Fill
=
"#AA93D427"
>
<
chartview:AreaSeries.TrackBallInfoTemplate
>
<
DataTemplate
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"0"
Grid.ColumnSpan
=
"2"
FontWeight
=
"Bold"
HorizontalAlignment
=
"Center"
Text
=
"{Binding Labels.ChartLast24Hours, Source={StaticResource PublicLabels}}"
/>
<
TextBlock
Grid.Row
=
"1"
Grid.Column
=
"0"
FontWeight
=
"Bold"
Text
=
"{Binding Labels.Timestamp, Source={StaticResource PublicLabels}, Converter={StaticResource StringToLabelConverter}}"
/>
<
TextBlock
Grid.Row
=
"1"
Grid.Column
=
"1"
Text
=
"{Binding DataPoint.Category, StringFormat='dd/MM/yyyy HH:mm'}"
/>
<
TextBlock
Grid.Row
=
"2"
Grid.Column
=
"0"
FontWeight
=
"Bold"
Text
=
"{Binding Labels.JamLength, Source={StaticResource PublicLabels}, Converter={StaticResource StringToLabelConverter}}"
/>
<
TextBlock
Grid.Row
=
"2"
Grid.Column
=
"1"
Text
=
"{Binding DataPoint.Value,StringFormat=\{0:n2\}km}"
/>
</
Grid
>
</
DataTemplate
>
</
chartview:AreaSeries.TrackBallInfoTemplate
>
</
chartview:AreaSeries
>
<
radchartview:RadCartesianChart.Grid
>
<
chartview:CartesianChartGrid
MajorLinesVisibility
=
"XY"
IsTabStop
=
"False"
>
<
chartview:CartesianChartGrid.YStripeBrushes
>
<
SolidColorBrush
Color
=
"Pink"
Opacity
=
"0.9"
/>
<
SolidColorBrush
Color
=
"Transparent"
/>
</
chartview:CartesianChartGrid.YStripeBrushes
>
<
chartview:CartesianChartGrid.XStripeBrushes
>
<
SolidColorBrush
Color
=
"#FFD7D7D7"
Opacity
=
"0.3"
/>
<
SolidColorBrush
Color
=
"Transparent"
/>
</
chartview:CartesianChartGrid.XStripeBrushes
>
</
chartview:CartesianChartGrid
>
</
radchartview:RadCartesianChart.Grid
>
</
radchartview:RadCartesianChart
>
</
Border
>
0
Hi Jeroen,
I have created a project based on the code that you have provided and I do not get any errors and I do not see any errors in the code.
We need some more information on your current project. Are you also referencing the Charting assembly or only the Chart assembly? Can you please verify if all referenced Telerik assemblies have the same version.
The only thing that comes to my mind is that may be you have not referenced the Controls and Data assemblies (Telerik.Windows.Controls and Telerik.Windows.Data), so please check this.
If this problem persists, I will have to ask that you open a support ticket and send us a project (which includes the binaries you use) that reproduces this exception, so that we can test and investigate the origins of this problematic behavior.
Kind regards,
Petar Marchev
the Telerik team
I have created a project based on the code that you have provided and I do not get any errors and I do not see any errors in the code.
We need some more information on your current project. Are you also referencing the Charting assembly or only the Chart assembly? Can you please verify if all referenced Telerik assemblies have the same version.
The only thing that comes to my mind is that may be you have not referenced the Controls and Data assemblies (Telerik.Windows.Controls and Telerik.Windows.Data), so please check this.
If this problem persists, I will have to ask that you open a support ticket and send us a project (which includes the binaries you use) that reproduces this exception, so that we can test and investigate the origins of this problematic behavior.
Kind regards,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jeroen
Top achievements
Rank 1
answered on 30 May 2012, 02:02 PM
Yes, I need both assemblies in my project.
I've recently uninstalled RadControls and reinstalled to ensure I have the latest version and ONLY the this version.
Every single referenced DLL has:
Runtime = v4.0.30319
Version = 2012.1.326.1050
I'll try to reproduce it in a new project.
I've recently uninstalled RadControls and reinstalled to ensure I have the latest version and ONLY the this version.
Every single referenced DLL has:
Runtime = v4.0.30319
Version = 2012.1.326.1050
I'll try to reproduce it in a new project.
0
Jeroen
Top achievements
Rank 1
answered on 01 Jun 2012, 09:10 AM
Haven't been able to reproduce it in a small new project, but I'll keep trying...
In the mean time, is it possible at all that this is somehow related to the 'Reduce XAP size by using application library caching' option?
In the mean time, is it possible at all that this is somehow related to the 'Reduce XAP size by using application library caching' option?
0
Hello,
We can not be certain if the library caching could be the cause of this, but it is an option to explore. Can you force a reload of the dlls and let us know how it goes?
Regards,
Petar Marchev
the Telerik team
We can not be certain if the library caching could be the cause of this, but it is an option to explore. Can you force a reload of the dlls and let us know how it goes?
Regards,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jeroen
Top achievements
Rank 1
answered on 04 Jun 2012, 07:35 AM
How do I do that?
0
Hello Jeroen,
As a start you can try to turn the option off. Give this a try and let us know how it goes. Also you can check the ClientBin folder and see if the xap file contains the proper dlls, with the proper version.
Can you also provide a list (snapshot) of which assemblies you have referenced. You can double check if all the assemblies are present in the ClientBin and if they have the same version.
Kind regards,
Petar Marchev
the Telerik team
As a start you can try to turn the option off. Give this a try and let us know how it goes. Also you can check the ClientBin folder and see if the xap file contains the proper dlls, with the proper version.
Can you also provide a list (snapshot) of which assemblies you have referenced. You can double check if all the assemblies are present in the ClientBin and if they have the same version.
Kind regards,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>