Esempio n. 1
0
        public void WriteXml(XmlWriter writer)
        {
            TypeConverter ffc = TypeDescriptor.GetConverter(typeof(FontFamily));
            TypeConverter fsc = TypeDescriptor.GetConverter(typeof(FontStyle));
            TypeConverter fwc = TypeDescriptor.GetConverter(typeof(FontWeight));
            TypeConverter rc  = TypeDescriptor.GetConverter(typeof(Rect));

            writer.WriteElementString("FontFamily", ffc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontFamily));
            writer.WriteElementString("FontStyle", fsc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontStyle));
            writer.WriteElementString("FontWeight", fwc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontWeight));
            writer.WriteElementString("FontSize", FontSize.ToString(CultureInfo.InvariantCulture));

            writer.WriteElementString("HorizontalAlignment", HorizontalAlignment.ToString());
            writer.WriteElementString("VerticalAlignment", VerticalAlignment.ToString());

            writer.WriteStartElement("Padding");
            writer.WriteElementString("Left", PaddingLeft.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Top", PaddingTop.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Right", PaddingRight.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Bottom", PaddingBottom.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            if (Decorations.HasFlag(Helios.TextDecorations.Underline))
            {
                writer.WriteStartElement("Underline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Strikethrough))
            {
                writer.WriteStartElement("Strikethrough");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Baseline))
            {
                writer.WriteStartElement("Baseline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.OverLine))
            {
                writer.WriteStartElement("OverLine");
                writer.WriteEndElement();
            }
        }