码迷,mamicode.com
首页 > 其他好文 > 详细

Textbox输入状态提示

时间:2016-04-08 09:03:15      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

前:

1  <DockPanel Margin="10">
2             <TextBox SelectionChanged="TextBox_SelectionChanged" DockPanel.Dock="Top" />
3             <TextBox Name="txtStatus" AcceptsReturn="True" TextWrapping="Wrap" IsReadOnly="True" />
4 
5         </DockPanel>

后:

1         private void TextBox_SelectionChanged(object sender, RoutedEventArgs e)
2         {
3             TextBox textBox = sender as TextBox;
4             txtStatus.Text = "Selection starts at character #" + textBox.SelectionStart + Environment.NewLine;
5             txtStatus.Text += "Selection is " + textBox.SelectionLength + " character(s) long" + Environment.NewLine;
6             txtStatus.Text += "Selected text: ‘" + textBox.SelectedText + "";
7         }

 

Textbox输入状态提示

标签:

原文地址:http://www.cnblogs.com/billly/p/5366429.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!