Static resource not found error
Hello,
I am getting an error that a static resource can not be found when using it in a DataTemplate defined in another resource dictionary. But it still works fine.
I can fix this by moving the dictionary below. Is this normal?
Error:
No Error:
I am getting an error that a static resource can not be found when using it in a DataTemplate defined in another resource dictionary. But it still works fine.
I can fix this by moving the dictionary below. Is this normal?
Error:
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Phase1.Ui.Overlay.Converters">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="SkillInfoTemplates.xaml" />
<ResourceDictionary>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Phase1.Ui.Overlay.Converters">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</ResourceDictionary>
<ResourceDictionary Source="SkillInfoTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Static resource not found error
Hello,
StaticResources can only be resolved if they can be found in the Application Resources or if they are defined before in the same xaml, so the order matters.
I guess the dictionary you posted is used as the Application Resources. This makes possible that resources defined in previously merged dictionaries are also available to the following merged dictionaries:
AppResources.xaml
In this example, if AppResources.xaml is used as the Application Resources, dictionary B can use resources from A. But not on the other direction, dictionary A can't use resources from B.
StaticResources can only be resolved if they can be found in the Application Resources or if they are defined before in the same xaml, so the order matters.
I guess the dictionary you posted is used as the Application Resources. This makes possible that resources defined in previously merged dictionaries are also available to the following merged dictionaries:
AppResources.xaml
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="A.xaml" />
<ResourceDictionary Source="B.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Who is online
Users browsing this forum: No registered users and 1 guest