我如何突出显示一个文本框 [英] How do i hightlight one textbox
本文介绍了我如何突出显示一个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Silverlight中,DataGrid的一个单元格中有两个TextBox,当该单元格进入编辑模式时,它们都突出显示,但是我只想要一个.例如,当我单击button1时,第一个TextBox高亮显示.我单击button2另一个亮点.如何实现?这是我的代码
I have two TextBox in a cell of DataGrid in silverlight,when the cell put into edit mode ,both of them highlight,but i just want one.For example,when i click button1 ,the first TextBox highlight.I click button2 another hightlight.How to do it?This is my code
<pre lang="xml"><my:DataGridTemplateColumn.CellEditingTemplate><br />
<DataTemplate><br />
<Grid x:Name="Root"><br />
<Grid><br />
<Grid.RowDefinitions><br />
<RowDefinition Height="25" /><br />
<RowDefinition Height="1" /><br />
<RowDefinition Height="25" /><br />
</Grid.RowDefinitions><br />
<Grid.ColumnDefinitions><br />
<ColumnDefinition Width="120"/><br />
</Grid.ColumnDefinitions><br />
<!-- Row 0 --><br />
<TextBox Background="#FFCCFAFB" Text="{Binding StartNO,Mode=TwoWay}"/><br />
<!-- Row 1 --><br />
<Line Stroke="#FF8CB2C6" X1="1" X2="84" Y1="1" StrokeDashArray="2" Grid.Row="1" Y2="1" /><br />
<!--<Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Height="1" Visibility="Visible" Grid.Row="1"/>--><br />
<!-- Row 2 --><br />
<TextBox Background="#FFCCFAFB" Text="{Binding EndNO,Mode=TwoWay}" Grid.Row="2"/><br />
</Grid><br />
</Grid><br />
</DataTemplate><br />
</my:DataGridTemplateColumn.CellEditingTemplate></pre><br />
推荐答案
单击按钮时,将.Focus()和.SelectAll()调用到文本框级别.
Hi,
When clicking the button call the .Focus() & .SelectAll() to the textbox level.
这篇关于我如何突出显示一个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文