locked
ParserContext incorrectly turns relative paths into absolute RRS feed

  • Question

  • If I understand well, ParserContext permits to resolve relative paths.

    For example I can specify an image using "Images\1.jpg" while the ParserContext specify the Base Uri to resolve this relative path.

    The problem is during save. If I use XamlWriter.Save the absolute path is saved so if the xaml is moved to another folder, the xaml resources cannot be reloaded anymore.

    So what is the trick to solve this?

    Thanks,
    Raffaele

    Tuesday, December 19, 2006 9:01 AM

Answers

  • This is a limitation of XAML serialization. See http://msdn2.microsoft.com/en-us/library/ms754193.aspx

    Best advice would be not to use it and implement your own method of serializing objects, which is what most xaml editors do by keeping a logical copy of the tree and implementing their own serializers.

    Tuesday, December 19, 2006 12:58 PM

All replies

  • This is a limitation of XAML serialization. See http://msdn2.microsoft.com/en-us/library/ms754193.aspx

    Best advice would be not to use it and implement your own method of serializing objects, which is what most xaml editors do by keeping a logical copy of the tree and implementing their own serializers.

    Tuesday, December 19, 2006 12:58 PM
  • Thanks for your reply...

    anyway this makes ParserContext useless since it's a one-way conversion instead of a real "context".

    Tuesday, December 19, 2006 10:02 PM
  • It's handy when reading XAML files, not when writting them. Hence the name ParserContext. :)
    Wednesday, December 20, 2006 11:18 AM