Prevent a readonly textbox from being grayed out in Silverlight

后端 未结 7 2106
天涯浪人
天涯浪人 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 06:52

    Nothing seems to work in the xaml (as usual), so the best solution I've come up with is make a textbox readonly myself without the IsReadOnly property.

    public class ReadOnlyTextBox : TextBox
    {
        protected override void OnKeyDown(KeyEventArgs e)
        {
            e.Handled = true;
            base.OnKeyDown(e);
        }
    }
    

提交回复
热议问题