public static string GetHexFromColor(SolidColorBrush Color) { string hexcolor = "#FFFF0000"; //argb типа byte конвертировать в hex var a = Color.Color.A; var r = Color.Color.R; var g = Color.Color.G; var b = Color.Color.B; //не допустимый термин byte BitConverter.ToString( byte[a, r, g, b], 0); return hexcolor; } This leads to a strange result: # FF-80-80-0080-80-0080-0000
Byte[] bytes1 = { a, r, g, b }; hexcolor = "#" + BitConverter.ToString(bytes1, 0) + BitConverter.ToString(bytes1, 1) + BitConverter.ToString(bytes1, 2) + BitConverter.ToString(bytes1, 3);