/// <summary> /// SampleColorTextBox テキスト変更イベントハンドラ /// </summary> /// <param name="sender">イベント発行元</param> /// <param name="e">イベント引数</param> private void PalleteColorTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (!_isSampleColorTextChangedFromUI) { return; } try { var str = this.PalleteColorTextBox.Text; if (!string.IsNullOrWhiteSpace(str)) { if (str[0] != '#') { throw new Exception(); } var colorCode = str.Substring(1, str.Length - 1); this._isRgbColorChangedFromUI = false; this._isHsvColorChangedFromUI = false; this.PalleteColor = ColorPickerItem.ColorFromCode(colorCode); this._isRgbColorChangedFromUI = true; this._isHsvColorChangedFromUI = true; this.OkButton.IsEnabled = true; } } catch (Exception err) { System.Diagnostics.Debug.WriteLine(err); this.OkButton.IsEnabled = false; } }