DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 15 Aug 2007 22:59:07 -0400,    posted on: microsoft.public.dotnet.xml        back       

Thread Index
  1    Dmitry Nogin
          2    Dmitry Nogin
          3    John Saunders [MVP] john.saunders at trizetto.com


How can I serialize Color type?   
Hi,

Can I xml serialize the property of type Color?

The following doesn't work:

[TypeConverter(typeof(ColorConverter))]
[XmlElement(typeof(string))]
public Color TextColor
{ get; set; }

How?

-- thanks
Date:Wed, 15 Aug 2007 22:59:07 -0400   Author:  

Re: How can I serialize Color type?   
"Dmitry Nogin"  wrote in message 
news:%23csweF73HHA.5160@TK2MSFTNGP05.phx.gbl...

> Can I xml serialize the property of type Color?


OK, I did it. Looks ugly...
private Color _textColor = SystemColors.WindowText;

[DisplayName("Text Color")]
[XmlIgnoreAttribute()]
public Color TextColor
{
    get { return _textColor; }
    set { _textColor = value; }
}

[XmlElement("TextColor")]
[Browsable(false)]
public string TextColorHtml
{
     get { return ColorTranslator.ToHtml(_textColor); }
     set { _textColor = ColorTranslator.FromHtml(value); }
}
Date:Thu, 16 Aug 2007 15:07:11 -0400   Author:  

Re: How can I serialize Color type?   
"Dmitry Nogin"  wrote in message 
news:%23csweF73HHA.5160@TK2MSFTNGP05.phx.gbl...

> Hi,
>
> Can I xml serialize the property of type Color?
>
> The following doesn't work:
>
> [TypeConverter(typeof(ColorConverter))]
> [XmlElement(typeof(string))]
> public Color TextColor
> { get; set; }


What happens if you remove the two attributes?
-- 
John Saunders [MVP]
Date:Thu, 16 Aug 2007 14:00:31 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us