This is a migrated thread and some comments may be shown as answers.

COM exception access resource dictionary

4 Answers 99 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark
Top achievements
Rank 1
Mark asked on 17 May 2012, 09:26 AM

   We're using the following code snippet to get the buttons etc on the map as per previous advice from Telerik.
On migrating from SL4 2012.1.215 to 2012.1.326 release the first line throws a COM exception.

I have tried referencing in the Office_Black.dll with no success.

var innerResourceDictionary = new ResourceDictionary
{
    Source = new Uri("/Telerik.Windows.Controls.DataVisualization;component/Themes/Map/OfficeBlack/Styles.xaml"UriKind.Relative)
};
var dataTemplate = innerResourceDictionary["MapSourceButton"as DataTemplate;
 
this.RegisterSetSourceCommand(typeof(RoadModeMapProvider), "Road", dataTemplate, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/map/road.png"UriKind.RelativeOrAbsolute), nullnull);
this.RegisterSetSourceCommand(typeof(ArialModeMapProvider), "Arial", dataTemplate, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/map/aerial.png"UriKind.RelativeOrAbsolute), nullnull);


4 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 21 May 2012, 01:20 AM
bump

nothing on what the Uri should be with the latest version of the code?

new Uri("/Telerik.Windows.Controls.DataVisualization;component/Themes/Map/OfficeBlack/Styles.xaml", UriKind.Relative) <-- this throws the exception

0
Accepted
Andrey
Telerik team
answered on 22 May 2012, 11:16 AM
Hello Liam,

Actually it is not a good idea to use internal control's resources (like templates and styles) in the application directly, because they can be changed, renamed or removed at any time. The 'MapSourceButton' data template doesn't exist as separate resource in the RadMap resource dictionary anymore. It was removed because of the changes in the RadMap styling and templating.
Currently the map source button uses default template if it is not specified (null). So, you can just not use ResourceDictionary and you can use a code like the following:
this.RegisterSetSourceCommand(typeof(RoadModeMapProvider), "Road", null, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/map/road.png", UriKind.RelativeOrAbsolute), null, null);
this.RegisterSetSourceCommand(typeof(ArialModeMapProvider), "Arial", null, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/map/aerial.png", UriKind.RelativeOrAbsolute), null, null);

Regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Mark
Top achievements
Rank 1
answered on 23 May 2012, 03:37 AM
I was only using the resource as per advice and suggestions from Telerik.

We ended up going with something fairly similar to what you suggested, removing all references to Uri's

this.RegisterSetSourceCommand(typeof(RoadModeMapProvider), "Road", null, null, null, null);
this.RegisterSetSourceCommand(typeof(ArialModeMapProvider), "Arial", null, null, null, null);

the road.png and arial.png Uri were not resolving anyway - so all we're missing is some fancy icons

to note: the new version of the map controls seems to perform much better than previous versions
0
Andrey
Telerik team
answered on 25 May 2012, 02:20 PM
Hi Liam,

Sometimes we should make breaking changes to improve our control for different purposes (performance, usability, implementation new features which appear in .net framework and silverlight like inline styling and so on). So, in some cases inner resources could be changed from one version to next.

In fact these png-files are used for Bing Maps provider which currently is our primary map provider. So, I think you can use them as a 'stable' resource.
I'm sorry for incorrect Uri to them in previous post. It seems it was a 'copy-paste' mistake. Currently these images are placed in the /Telerik.Windows.Controls.DataVisualization;component/themes/ path. So, you can use them like this:

this.RegisterSetSourceCommand(typeof(RoadModeMapProvider), "Road", null, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/road.png", UriKind.RelativeOrAbsolute), null, null);
this.RegisterSetSourceCommand(typeof(ArialModeMapProvider), "Arial", null, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/aerial.png", UriKind.RelativeOrAbsolute), null, null);

Greetings,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Map
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or