Created
February 23, 2015 10:15
-
-
Save jrgcubano/7e5e169ee87d8b4e5b9e to your computer and use it in GitHub Desktop.
TextBox that's Read Only which just looks like a TextBlock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style x:Key="ReadOnlyTextBox" TargetType="TextBox"> | |
<Setter Property="IsReadOnly" Value="True" /> | |
<Setter Property="Padding" Value="5"/> | |
<Setter Property="Margin" Value="0"/> | |
<Setter Property="Background" Value="Transparent"/> | |
<Setter Property="BorderBrush" Value="Transparent"/> | |
<Setter Property="BorderThickness" Value="0"/> | |
<Setter Property="IsTabStop" Value="False"/> | |
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/> | |
<Setter Property="VerticalScrollBarVisibility" Value="Disabled"/> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="TextBox"> | |
<Grid x:Name="RootElement"> | |
<ScrollViewer x:Name="ContentElement" | |
Margin="{TemplateBinding Margin}" | |
Background="{TemplateBinding Background}" | |
BorderBrush="{TemplateBinding BorderBrush}" | |
BorderThickness="{TemplateBinding BorderThickness}" | |
IsTabStop="{TemplateBinding IsTabStop}" | |
Padding="{TemplateBinding Padding}" | |
HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}" | |
VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"/> | |
</Grid> | |
</ControlTemplate> | |
</Setter.Value> | |
</Setter> | |
</Style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment