Prevent a readonly textbox from being grayed out in Silverlight

后端 未结 7 2152
天涯浪人
天涯浪人 2021-02-20 06:50

In Silverlight, How do I make a TextBox with IsReadOnly=\"True\" not become grayed out. The gray effect looks horrible with my app and I would like to disable it, o

7条回答
  •  星月不相逢
    2021-02-20 07:00

    I found @Simon_Weaver's solution the easiest to implement. The only change I made was to check for Key.Tab along with left/right/up/down so that I could tab out of the field. I created the class ReadOnlyTextBox and copied the code above. Then I added the check for Key.Tab and compiled. Next I changed my Xaml tag from

    
    

    to

    
    

    (removing the IsEnabled reference and adding the background color). It looks and works exactly as I expected.

    Thanks Simon.

提交回复
热议问题