10

I'm working on my first WPF application and I notice that I'm not able to edit the text values in any of my textblocks.

I can't seem to find anything wrong here that would prevent me from changing it...

<Label Content="Line Terminator" Grid.Row="0" Grid.Column="0" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="1" Margin="5">
    <TextBlock x:Name="txtLineTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>
<Label Content="Field Terminator" Grid.Row="0" Grid.Column="2" Margin="5"></Label>
<Border BorderThickness="1" BorderBrush="LightBlue" Grid.Row="0" Grid.Column="3" Margin="5">
    <TextBlock x:Name="txtFieldTerm" Focusable="True" IsManipulationEnabled="True" Padding="3"></TextBlock>
</Border>

Can anyone see the problem? I feel like there's a concept that I'm missing here. Any explanation will be greatly appreciated.

Ortund
  • 8,095
  • 18
  • 71
  • 139
  • 1
    see this too : http://stackoverflow.com/questions/136435/any-way-to-make-a-wpf-textblock-selectable – Hyde Jan 30 '13 at 08:59
  • 1
    Are you asking how to edit the `TextBlock` at runtime, or designtime? Despite the accepted answer, both are possible... *(What a `TextBlock` **cannot** do is have a user click on it and edit it in-place, like a `TextBox`)* – BlueRaja - Danny Pflughoeft Oct 05 '13 at 21:52

2 Answers2

22

TextBlock is not editable. Use TextBox instead.

Memoizer
  • 2,231
  • 1
  • 14
  • 14
4

you can use EditableTextBlock as shown in the link

Vikram
  • 1,617
  • 5
  • 17
  • 37