visc
visc

Reputation: 4959

TextBox doesn't have BorderStyle Property

I'm trying to create a TextBox that is selectable but looks like a label. Other people have talked about setting the BorderStyle to None in order to hide the TextBox look and feel. Why can't I access the BorderStyle from my Xaml? I'm using the MVVM design pattern.

enter image description here

Upvotes: 0

Views: 283

Answers (1)

Flat Eric
Flat Eric

Reputation: 8111

BorderStyle exists only in WinForms while WPF uses BorderThickness and BorderBrush

The simplest way would be this:

<TextBox BorderThickness="0" Background="Transparent" />

For more customization, you could override the ControlTemplate, for example described in this post: wpf textbox flat border style

By the way: It could be confusing for the user, if a control looks totally different than the way it looks in most applications.

Upvotes: 5

Related Questions