Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix: XAML2009 language construct is not allowed here?

In my App.xaml code I have the following code:

<Application x:Class="PcgTools.App"
    ...
    <Application.Resources>
        <ResourceDictionary>
             ...
            <res:Strings x:FactoryMethod="res:StringResourceHelper.GetStringResources" 
             x:Key="LocStrings"/>
        </ResourceDictionary> 
    </Application.Resources>
</Application>

I got from the VS2012 compiler an error before to use the FactoryMethod or Attribute construct. But now I get the error: Xaml2009 language construct is not allowed here.

How to fix this?

like image 333
Michel Keijzers Avatar asked Jan 15 '13 21:01

Michel Keijzers


2 Answers

XAML 2009 is unfortunately useless due to lack of compiler support (although VS recognises it for some stupid reason).

See: MSDN doc on XAML 2009

Basically no current compiler (WPF, SL, WinRT) actually supports it. As far as I know, the only thing which supports XAML 2009 is "loose xaml", where you have a stand-alone xaml file that is opened by a browser directly (which is basically useless).

I don't know of any explanation from Microsoft outlining why on earth it isn't supported. :-(

like image 105
Duncan Matheson Avatar answered Oct 27 '22 00:10

Duncan Matheson


XAML 2009 is not allowed in compiled XAML (at least not in WPF 4.0), try to move your stuff that uses 2009 constructs to a separate Resource Dictionary file.

like image 41
Federico Berasategui Avatar answered Oct 27 '22 01:10

Federico Berasategui