How to serialize a SystemColor by its name and not its hex value?

Instead of serializing [Color="#FFAB83EF"], I'd like to serialize as [Color="{x:Static SystemColors.ControlDarkColor}"].  It looks like System.Window.Serialization.StaticExtension should be able to do it, but I'm unable to get it to work.  Any ideas or help would be appreciated.



Answer this question

How to serialize a SystemColor by its name and not its hex value?

  • Devil_Soul

    Serialization isn't able to write out the color as an x:Static reference.  It's actually the Color's TypeConverter that's producing this string, and it doesn't have enough context to know that it could be writing out a system color reference here.

    Thanks,
    Mike


  • How to serialize a SystemColor by its name and not its hex value?