How do I get textbox to fill the column and autoscroll?

Posted by Stephen Price on Stack Overflow See other posts from Stack Overflow or by Stephen Price
Published on 2010-05-26T03:03:27Z Indexed on 2010/05/26 3:11 UTC
Read the original article Hit count: 299

I have the following code in my DataGridTemplateColumn:

<Controls:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
    <StackPanel Orientation="Horizontal">
        <TextBox Text="{Binding AlternateTeacherName, Mode=TwoWay}" Style="{StaticResource InputTextBox}"/>
    </StackPanel>
</DataTemplate>

Style is:

<Style x:Key="InputTextBox" TargetType="TextBox" >
<Setter Property="Margin" Value="1" />
<Setter Property="MinWidth" Value="30" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="HorizontalAlignment" Value="Stretch" />

Problem I'm getting is that the textbox fills the column width correctly (including when you resize it) but if I type into the textbox the cursor is not visible when it reaches the end of the line. I'd like the text to scroll off the left so that the current text is still visible.

thanks

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-3.0