Launching my wpf application and trying to show a particular control i receive this exception:
"FileNotFoundException - Cannot load file or assembly "Xceed.WPF.Toolkit.resources, version=2.0.0.0, Culture=it-IT...."
I know it seems a problem already discussed but my problem is a little bit more specific.
I have my application ( Wolf.exe ) that works with a plugin system. The plugin system load plugin classes from external dll located inside the Extension application folder ( this folder is located at the same level of the .exe ). Plugins are able to load extra resources, like xaml dictionary, and specify custom Styles to extend base components.
One of this plugin/assembly ( FSMExtension.dll ) load extra xaml resources in this way:
FileStream oFileStream = new FileStream(filename, FileMode.Open);
if (oFileStream != null)
{
ResourceDictionary oResourceDictionary = (ResourceDictionary)XamlReader.Load(oFileStream);
if (oResourceDictionary != null)
{
Application.Current.Resources.MergedDictionaries.Add(oResourceDictionary);
}
}
oFileStream.Close();
FSMExtension.dll has a dependency on the "Extended WPF Toolkit™ Community Edition" ( http://wpftoolkit.codeplex.com/documentation ) cause it needs a PropertyGrid component. The resulted xaml has a similar aspect:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:WolfLib.UI.Converters;assembly=WolfLib"
xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit.PropertyGrid;assembly=Xceed.Wpf.Toolkit">
<converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" IsHidden="false" TriggerValue="false"></converters:BooleanToVisibilityConverter>
<Style x:Key="FSMBlockStyle" TargetType="ContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<xctk:PropertyGrid Grid.Row="5" Grid.ColumnSpan="2" Margin="5 0 5 5" Visibility="{Binding ElementName=PropertyToggleButton, Path=IsChecked, Converter={StaticResource BoolToVisibilityConverter}}"
ShowSummary="false"
IsCategorized="true"
ShowAdvancedOptions="false"
IsReadOnly="false"
ShowSortOptions="false"
ShowSearchBox="false"
ShowTitle="false"
AutoGenerateProperties="false"
MaxWidth="300">
<xctk:PropertyGrid.PropertyDefinitions>
<xctk:PropertyDefinition TargetProperties="Name,Type,MainController,Views,ControllerBehaviours,ControllerParams"/>
</xctk:PropertyGrid.PropertyDefinitions>
</xctk:PropertyGrid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
When I apply the specific style to my control I receive the exception above. This exception doesn't occur if i try to use directly the PropertyGrid control inside my Application ( on MainWindow.xaml ). This problem is strange also because i don't have any kind of .resources.dll file for this assembly.
The only way I've found to fix the problem is to specify the default culture assembly for "Extended WPF Toolkit™ Community Edition" and rebuild it.
This fix will work for my machine configuration with a "it-IT" language/culture. If I launch my application in a different machine with e different culture ( i.e en-US ) the exception will be thrown again.
Is there a specific way to deal with this kind of problem ? Let me know if you need more information.