View previous topic :: View next topic |
Author |
Message |
gunters63
Joined: 25 Jan 2011 Posts: 21
|
Posted: Tue Aug 07, 2012 2:19 pm Post subject: ResoureDictionary with localizable resources |
|
|
Hi,
I have a ResourceDictionary with lots of DataTemplates in it. Those DataTemplates have TextBoxes, Grid Headers etc. I want to localize.
When scan this ResourceDictionary xaml file Globalizer puts a
Code: |
ResxExtension.DefaultResxName="SonicTC.View.Component.Views.DeviceDataTemplates"
|
inside the top level ResourceDictionary definition.
Unfortunately this leads to an exception later while loading this file because:
Code: | Object of type 'System.Windows.ResourceDictionary' cannot be converted to type 'System.Windows.DependencyObject'. |
Probably because the attached property ResxExtension.DefaultResxName cannot be applied to a ResourceDictionary.
Can i suppress the generation of ResxExtension.DefaultResxName or is there another workaround (except to exclude this file which i don't want)? |
|
Back to top |
|
|
gunters63
Joined: 25 Jan 2011 Posts: 21
|
Posted: Tue Aug 07, 2012 2:26 pm Post subject: |
|
|
I found the option unter "Set default ResxName".
I had to revert the changes Globalizer made, uncheck this option and scan again.
Setting the default ResxName with an attached property will always fail on ResourceDictionaries. Probably Globalizer can ignore the setting in this case. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Aug 09, 2012 12:48 am Post subject: |
|
|
Thanks - yes you can just turn off this option for Resource Dictionary files - however we will look at ignoring it automatically in these cases. _________________ Infralution Support |
|
Back to top |
|
|
bdwyer
Joined: 27 Aug 2012 Posts: 10
|
Posted: Wed Sep 12, 2012 10:01 pm Post subject: |
|
|
Hate to re-open this, but is there a way to use the ResXExtension inside resource dictionaries + DataTemplates?
The options listed below address the situation of the scanner automatically messing the dictionaries up, but I still like to use the ResXExtension to handle localization of content within my DataTemplates. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 12, 2012 10:42 pm Post subject: |
|
|
You can use ResxExtension within ResourceDictionaries - you just have to turn the "Set default ResxName" option off. This means that when Globalizer scans and converts elements to use the ResxExtension it will specify the ResxName for each element (since it can't specify the ResxName at the top level).
Note that you can't use ResxExtension in Style Setters - see the following thread for more information:
http://www.infralution.com/phpBB2/viewtopic.php?t=2469 _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Feb 07, 2013 6:24 am Post subject: |
|
|
Version 3.5.0 of Globalizer has been released and fixes this issue so that the DefaultResxName is not set for ResourceDictionaries. _________________ Infralution Support |
|
Back to top |
|
|
|