View previous topic :: View next topic |
Author |
Message |
kevinkuebler
Joined: 19 Jan 2015 Posts: 20 Location: United States
|
Posted: Tue May 17, 2016 7:57 pm Post subject: Resx namespace question |
|
|
Today one of our developers started experiencing some strange behavior related to the Resx extension in our WPF project. We use VS 2013, along with the latest version of R#. For some reason, R# has started prompting him to import the namespace for the Resx extension everywhere it's used in our XAML.
The odd thing is it's only happening to him ... nobody else on our team has experienced this yet. When he told me about this, it made me realize something I had never noticed about the Resx extension before - it doesn't require a namespace to be imported in the XAML to use it, even though it exists in the Infralution.Localization.Wpf namespace. How does that work? And do you have any idea why R# may have suddenly gotten confused by it?
Thanks,
Kevin Kuebler |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu May 19, 2016 2:04 am Post subject: |
|
|
The Resx Extension uses the XmlnsDefinition attribute on the assembly to map Infralution.Localization.Wpf types in the base CLR namespace. See the following link for more information:
http://paulstovell.com/blog/xmlnsdefinition
The assembly attributes that do this haven't been updated since 2008 - but still appear to work for later visual studio versions - perhaps because they by default reference these namespaces. The definitions are in the ResxExtension are:
Code: | [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "Infralution.Localization.Wpf")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2007/xaml/presentation", "Infralution.Localization.Wpf")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2008/xaml/presentation", "Infralution.Localization.Wpf")]
|
Perhaps the reason it isn't working for the developer is because their default namespaces do not include one of these? _________________ Infralution Support |
|
Back to top |
|
|
kevinkuebler
Joined: 19 Jan 2015 Posts: 20 Location: United States
|
Posted: Thu May 19, 2016 4:14 pm Post subject: |
|
|
Okay, thanks for the info. That's very interesting, I didn't know about that attribute. But I have seen the effect of it before, where control vendors often map all of their assembly's namespaces into one overall namespace (like the "http://xamlforge.com/magellan" example Paul used in that blog post). Makes sense now.
As for the one developer on our team who had this issue, it suddenly went away. He definitely had the normal default namespace defined ... he was seeing the issue on the same XAML files that the rest of us work on everyday. So I guess it was most likely just a flaky issue with R# that somehow resolved itself. Thanks for the info though! |
|
Back to top |
|
|
|