16 進数値から色を取得しようとすると、ArgumentOutOfRangeException が発生します。
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;
この問題の原因となる可能性のあるものを見逃していますか?