Articles in categories


Make WPF TextBox look like TextBlock

I needed a selectable TextBlock to show some id. However a TextBlock is not selectable so I made a TextBox look like a TextBlock. A TextBlock is selectable..

You only need the properties 'Background' and 'Border':

<TextBox x:Name="textBlockProductId"
	 Text="{Binding SelectedProductId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

That's it, your TextBox will look like a TextBlock!