Prevent a readonly textbox from being grayed out in Silverlight

后端 未结 7 2115
天涯浪人
天涯浪人 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:08

    There are a couple of options in Silverlight 2, the simplest would be to use a TextBlock since that's only ever readonly.

    If you need a TextBox then what you need to do is give it a different style that doesn't do the grey affect.

    To do this open up blend. right click on your TextBox and select Edit Control Parts (Template) -> Edit a Copy... Call the new style whatever you want.

    You then want to edit this new style and delete the border called "ReadOnlyVisualElement" and delete the storyboard that alters the opacity property of that border.

    Hope this helps.

    Added Style XAML

        
    

    I would get the preview of Blend, coding the above by hand would be a large amount of unnecessary work.

提交回复
热议问题