[Solved] When the ForeColor is changed in the TextChanged event, the MouseOver (hover) effect stops working.

1 Answer 20 Views
DropDownList TextBox
Shiori
Top achievements
Rank 1
Shiori asked on 03 Jun 2026, 07:54 AM | edited on 03 Jun 2026, 07:55 AM

私はRadTextBoxとRadDropDownListを使っており、TextChangedイベントが発生し値が無効と判断されると、テキストの色が赤に変わるロジックを実装しています。

エラーが解決したら、テキストの色を元の色に戻します。しかし、テキストの色をリセットした後、マウスオーバー(ホバー)効果がもう機能しなくなったようです。

通常、RadTextBoxにカーソルを合わせると、状態(2)から状態(1)へと変化します(状態(1)と状態(2)の定義については添付の画像を参照してください)。しかし、TextChangedイベントが発生したRadTextBoxの場合、テキストの色が復元された後も(1)の状態にとどまります。同じ問題はRadDropDownListでも発生します。

テキストの色をリセットした後に、元のMouseOverの動作を復元するための追加の設定や方法はありますか?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 03 Jun 2026, 12:02 PM

Hello Shiori,

Thank you for the provided details.

May I ask you to share how the text color is reset back to its default value? In general, if you want to reset the value of a property, you should use the ResetValue() method to restore the previous state.

this.radTextBox1.TextBoxElement.ResetValue(VisualElement.ForeColorProperty, ValueResetFlags.Local);

If that does not help, can you share the Theme that is used in the application and which properties are set to the controls?

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Modernizing a WinForms application? Use the AI-powered WinForms Converter to simplify migration to Telerik UI for WinForms.
Shiori
Top achievements
Rank 1
commented on 04 Jun 2026, 12:37 AM | edited

こんにちは、 ご支援ありがとうございます。 Loadイベントで、ターゲットテキストボックスのForeColorを取得しました。エラーが発生した場合は、コントロールを設定します。ForeColor = System.Drawing.Color.Red(コントロール:RadTextBox または RadDropDownList)。エラーが解決したとき、コントロールで復旧しました。ForeColor = ForeColor(ロードイベントで得られたForeColor値を使用)。
ResetValue()を使ってみましたが、エラーが発生してテキストが赤くなると元の色に戻らなくなりました。 しかし、エラーを発生させずに変更を加えた場合は、期待通りに動作しました。 使用されているテーマは「FluentDark」と「Fluent」の2種類があります。テーマも入れ替わります。
Dinko | Tech Support Engineer
Telerik team
commented on 04 Jun 2026, 08:36 AM

Thank you for the additional details.

Since your application uses both Fluent and FluentDark themes and can switch between them at runtime, it is possible that the interaction between theme-managed colors and locally assigned ForeColor values is affecting the behavior.

Could you please help me with the following information?

  • Does the same issue occur if the theme is not changed during runtime?
  • Which version of Telerik UI for WinForms are you using?

I have prepared a sample project that I think is close to your implementation. May I ask you to check it out and share the steps I need to follow to reproduce this behavior?

I am looking forward to your reply.

Shiori
Top achievements
Rank 1
commented on 10 Jun 2026, 05:02 AM

Hi,

I tried the sample project, and it worked exactly as expected. Thank you very much.
Tags
DropDownList TextBox
Asked by
Shiori
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or