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

ResourceDictionary

4 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Todor
Top achievements
Rank 1
Todor asked on 17 Feb 2009, 01:27 PM
Hello,

Can you give me an example how to use the ResourceDictionary you provide in order to mimic the WPF behaviour of MergedDictionaries, because I get an ERROR that the MergedDictionaries property is already set and my controls don't get their templates loaded.

4 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 18 Feb 2009, 07:54 AM
Hello Todor,

Here is the syntax of the Telerik Resource dictionary:

<telerik:ResourceDictionary Source="[uri to a xaml file, containing standard ResourceDictionary]" Keys="[comma separated list of all keys that should be copied from the Source]" />

To apply a Telerik ResourceDictionary you need to do one of the two options below:
1) Set the attached property telerik:ResourceDictionary.MergedDictionaries on a ResourceDictionary:
<ResourceDictionary xmlns=... xmlns:x=... xmlns:telerik=...>
    <telerik:ResourceDictionary.MergedDictionaries>
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
    <telerik:ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

2) Set the attached property on a FrameworkElement to merge the source dictionary with the Resources property of the target element:
<StackPanel>
    <telerik:ResourceDictionary.MergedDictionaries>
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
    <telerik:ResourceDictionary.MergedDictionaries>
</StackPanel>

Note that the source resources will not overwrite the target resources with the same keys, and also visual studio and blend show errors when the attached property is set multiple times, but there are no problems in runtime.

Sincerely yours,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Todor
Top achievements
Rank 1
answered on 18 Feb 2009, 09:04 AM
Thanks Valeri, works like a charm :)
0
Cheng Lim Sek
Top achievements
Rank 1
answered on 12 Nov 2009, 10:29 AM
Hi

Setting the attached property telerik:ResourceDictionary.MergedDictionaries on a ResourceDictionary like you mention is not working in the Q3.
When I try to write telerik:ResourceDictionary, I cannot find the ResourceDictionary property.
I search through the Object Browser on the Telerik.Window.Controls, it do not have the ResourceDictionary in the libraries.

Am I missing anything or the Q3 have remove this property. How can I solve this if I want to do something like this:
<ResourceDictionary xmlns=... xmlns:x=... xmlns:telerik=...>
    <telerik:ResourceDictionary.MergedDictionaries>
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
        <telerik:ResourceDictionary Source="..." Keys="..." />
    <telerik:ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
0
Hristo
Telerik team
answered on 12 Nov 2009, 03:15 PM
Hi Cheng Lim Sek,

Just remove the telerik: and Keys="...".
Silverlight 3 supports MergedDictionaries so there is no need to use Telerik.MergedDictionaries anymore. They were marked as obsolete in Q2 (or Q2.SP1).

Kind regards,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Todor
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Todor
Top achievements
Rank 1
Cheng Lim Sek
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or