我得到ArgumentOutOfRangeException,當我嘗試從hexavalues獲取顏色時。ArgumentOutOfRangeException在Wp7中獲取GetColorFromHexa時未處理
public static SolidColorBrush GetColorFromHexa(string hexaColor)
{
return new SolidColorBrush(
Color.FromArgb(
Convert.ToByte(hexaColor.Substring(1, 2), 16),
Convert.ToByte(hexaColor.Substring(3, 2), 16),
Convert.ToByte(hexaColor.Substring(5, 2), 16),
Convert.ToByte(hexaColor.Substring(7, 2), 16)
)
);
}
SolidColorBrush brush = GetColorFromHexa("#ADD8E6");
border.Background = brush;
我錯過了什麼可能是這個問題的原因?