ColorProperty Sample

Back to summary

Source

using System.Windows.Media;

namespace XmlSerializersTest.Samples
{
    [Title("Property of type Color")]
    public class ColorProperty
    {
        public Color Color { get; set; }
    }
}

Standard Serializer

<ColorProperty>
  <Color>
    <A>255</A>
    <R>255</R>
    <G>0</G>
    <B>0</B>
    <ScA>1</ScA>
    <ScR>1</ScR>
    <ScG>0</ScG>
    <ScB>0</ScB>
  </Color>
</ColorProperty>

XAML Serializer

<ColorProperty Color="#FFFF0000" xmlns="clr-namespace:XmlSerializersTest.Samples;assembly=XmlSerializersTest" />

WCF Serializer

<ColorProperty xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/XmlSerializersTest.Samples">
  <Color xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Windows.Media">
    <d2p1:A>255</d2p1:A>
    <d2p1:B>0</d2p1:B>
    <d2p1:G>0</d2p1:G>
    <d2p1:R>255</d2p1:R>
    <d2p1:ScA>1</d2p1:ScA>
    <d2p1:ScB>0</d2p1:ScB>
    <d2p1:ScG>0</d2p1:ScG>
    <d2p1:ScR>1</d2p1:ScR>
  </Color>
</ColorProperty>

WCF-ref Serializer

<ColorProperty xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://schemas.datacontract.org/2004/07/XmlSerializersTest.Samples">
  <Color xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Windows.Media">
    <d2p1:A>255</d2p1:A>
    <d2p1:B>0</d2p1:B>
    <d2p1:G>0</d2p1:G>
    <d2p1:R>255</d2p1:R>
    <d2p1:ScA>1</d2p1:ScA>
    <d2p1:ScB>0</d2p1:ScB>
    <d2p1:ScG>0</d2p1:ScG>
    <d2p1:ScR>1</d2p1:ScR>
  </Color>
</ColorProperty>