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="Back开发者_开发技巧ground" 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
Take out the StackPanel. It aligns its elements from left to right and does not stretch to fill the remaining space. You can probably also get rid of HorizontalAlignment and MinWidth in your Style. If you must set a MinWidth, it should be on the column.
精彩评论