none
How to avoid Invalid Markup after generating x:Static markup extension RRS feed

  • Question

  • I have a visual studio extension which generates localization code for different project types.

    With WPF projects, my technique is to generate named resources - usually in Resources.resx - and use the markup extension x:Static to refer to the resource string.

    For example, with the XML prefix

    xmlns:res="clr-namespace:<root namespace>.Properties

    and the markup extension

    {x:Static res:Resources.Hello_World2}

    After generating this code, the XAML design window look like this:

    As soon as I compile the project, the error is removed, and the XAML designer is able to show the UI.

    Now I could probably live with that, but I want to make a good product and I want it to make a good impression on new users. It would be a lot cooler if my extension generated this code, and the XAML designer showed the results immediately.

    Is there any to achieve this, without actually recompiling the project?

    By the way, intellisense does know about the new symbol, and if I select "go to definition" (F12) it correctly goes to the code in the Resources.Designer.cs file. Only the design view is a problem.

    (I have already asked this question on StackOverflow, but there has been no reply after 20 days.)

    Phil

    Sunday, November 11, 2018 7:38 AM

All replies

  • Hey Phil,

    To you find a solution for your problem? I think I have the same problem but with the effect that the invalid markup stays after the correctly compiling...

    Wednesday, May 29, 2019 10:42 AM