Reputation: 1072
I have this file called Produtos.cs (Produtos = Products)
namespace LabApp4.Models
{
public class Produto
{
public int Codigo { get; set; }
public string Titulo { get; set; }
public string Descricao { get; set; }
public int Ano { get; set; }
public string Letter { get; set; }
}
}
How can i implement some var that would store a color? I tried some examples here, but no sucess.
Upvotes: 0
Views: 80
Reputation: 29792
There are couple of solutions to solve this, for example you can use properties defined like this:
// this can be serializable if needed
public string color;
// non-serializable
public SolidColorBrush ItemBrush
{
get
{
return new SolidColorBrush(Windows.UI.Color.FromArgb(byte.Parse(color.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
byte.Parse(color.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), byte.Parse(color.Substring(5, 2), System.Globalization.NumberStyles.HexNumber),
byte.Parse(color.Substring(7, 2), System.Globalization.NumberStyles.HexNumber)));
}
set { color = value.Color.ToString(); }
}
Upvotes: 1