Skip to content

Instantly share code, notes, and snippets.

@JohanLarsson
Created January 6, 2014 15:12
Show Gist options
  • Save JohanLarsson/8284177 to your computer and use it in GitHub Desktop.
Save JohanLarsson/8284177 to your computer and use it in GitHub Desktop.
<Style x:Key="EditableTextBlockStyle" TargetType="TextBox">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="BorderBrush" Value="{x:Null}"/>
<Setter Property="Background" Value="{x:Null}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="-2,-1,-2,-1"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="MaxLines" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Focusable" Value="True"/>
</Style>
<Style TargetType="{x:Type controls:EditableTextBlock}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:EditableTextBlock}">
<TextBox Text="{TemplateBinding Text}" Style="{StaticResource EditableTextBlockStyle}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment