data types I can save

Feb 5, 2011 at 8:13 PM

I am just wondering if there is a way for me to store a SolidColorBrush as a property on an object that gets saved to my Sterling database. My object is bound to a user control and I would like to be able to store a color that I can bind to. I tried it and it didn't seem to work.

Feb 5, 2011 at 8:40 PM

Looks like I might be able to  use the Serializer class, but I'm not sure how I would use it for a solidcolorbrush:

 

public class FoodSerializer: BaseSerializer    {      

  public override bool CanSerialize(Type targetType)

{            return targetType.Equals(typeof(NutrientDataElement));        }

public override void Serialize(object target, BinaryWriter writer)      

 {            var data = (NutrientDataElement)target;          

      writer.Write(data.NutrientDefinitionId);          

             writer.Write(data.AmountPerHundredGrams);      

 }

 public override object Deserialize(Type type, BinaryReader reader)      

 {            return new NutrientDataElement          

      {                NutrientDefinitionId = reader.ReadInt32(),                AmountPerHundredGrams = reader.ReadDouble()            };      

 }  

 }