Currently you can only deserialize custom markup extensions and in my case I would really like to be able to serialize them to avoid messy string handling.
There could be two approaches to this:
Make XamlServices behave like System.Windows.Markup.XamlWriter, which not only tries to convert anything with a TypeConverterAttribute to a string but also a MarkupExtension. You can read this blog post for more details.
Extend the XamlObjectReader by allowing nested readers with a different type, which in this case would be a custom markup extension. I tried this approach by deriving from XamlObjectReader and having a nested XamlObjectReader for the custom markup extension, but I faced issues concerning namespaces.
Currently you can only deserialize custom markup extensions and in my case I would really like to be able to serialize them to avoid messy string handling.
There could be two approaches to this:
XamlServices
behave likeSystem.Windows.Markup.XamlWriter
, which not only tries to convert anything with aTypeConverterAttribute
to a string but also aMarkupExtension
. You can read this blog post for more details.XamlObjectReader
by allowing nested readers with a different type, which in this case would be a custom markup extension. I tried this approach by deriving fromXamlObjectReader
and having a nestedXamlObjectReader
for the custom markup extension, but I faced issues concerning namespaces.