本文整理汇总了C#中TextChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TextChangedEventArgs类的具体用法?C# TextChangedEventArgs怎么用?C# TextChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextChangedEventArgs类属于命名空间,在下文中一共展示了TextChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindBoxTextChanged
private void FindBoxTextChanged(object sender, TextChangedEventArgs e)
{
string textToFind = findBox.Text;
if (textToFind != null)
FindAndHighlightText(textToFind);
}
示例2: fctb_TextChanged
private void fctb_TextChanged(object sender, TextChangedEventArgs e)
{
//clear folding markers
e.ChangedRange.ClearFoldingMarkers();
//set markers for folding
e.ChangedRange.SetFoldingMarkers("{", "}");
}
示例3: DesiredAccuracyInMeters_TextChanged
void DesiredAccuracyInMeters_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
uint value = uint.Parse(DesiredAccuracyInMeters.Text);
SetDesiredAccuracyInMeters.IsEnabled = true;
// clear out status message
rootPage.NotifyUser("", NotifyType.StatusMessage);
}
catch (ArgumentNullException)
{
SetDesiredAccuracyInMeters.IsEnabled = false;
}
catch (FormatException)
{
rootPage.NotifyUser("Desired Accuracy must be a number", NotifyType.StatusMessage);
SetDesiredAccuracyInMeters.IsEnabled = false;
}
catch (OverflowException)
{
rootPage.NotifyUser("Desired Accuracy is out of bounds", NotifyType.StatusMessage);
SetDesiredAccuracyInMeters.IsEnabled = false;
}
}
示例4: markkaTextBox_TextChanged
private void markkaTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (changing)
{
if (markkaTextBox.Text.Length > 0)
{
result = Double.TryParse(markkaTextBox.Text, out markkaToEuro);
if (result)
{
markkaToEuro = Convert.ToDouble(markkaTextBox.Text);
markkaToEuro = markkaToEuro / 5.94573;
}
else
{
markkaToEuro = 0;
}
}
else
{
markkaToEuro = 0;
}
euroTextBox.Text = markkaToEuro.ToString("0.00");
changing = false;
}
}
示例5: CSharpSyntaxHighlight
private void CSharpSyntaxHighlight(TextChangedEventArgs e)
{
fctb.LeftBracket = '(';
fctb.RightBracket = ')';
fctb.LeftBracket2 = '\x0';
fctb.RightBracket2 = '\x0';
//clear style of changed range
e.ChangedRange.ClearStyle(BlueStyle, BoldStyle, GrayStyle, MagentaStyle, GreenStyle, BrownStyle);
//string highlighting
e.ChangedRange.SetStyle(BrownStyle, @"""""|@""""|''|@"".*?""|(?<[email protected])(?<range>"".*?[^\\]"")|'.*?[^\\]'");
//comment highlighting
e.ChangedRange.SetStyle(GreenStyle, @"//.*$", RegexOptions.Multiline);
e.ChangedRange.SetStyle(GreenStyle, @"(/\*.*?\*/)|(/\*.*)", RegexOptions.Singleline);
e.ChangedRange.SetStyle(GreenStyle, @"(/\*.*?\*/)|(.*\*/)", RegexOptions.Singleline|RegexOptions.RightToLeft);
//number highlighting
e.ChangedRange.SetStyle(MagentaStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?[lLdDfF]?\b|\b0x[a-fA-F\d]+\b");
//attribute highlighting
e.ChangedRange.SetStyle(GrayStyle, @"^\s*(?<range>\[.+?\])\s*$", RegexOptions.Multiline);
//class name highlighting
e.ChangedRange.SetStyle(BoldStyle, @"\b(class|struct|enum|interface)\s+(?<range>\w+?)\b");
//keyword highlighting
e.ChangedRange.SetStyle(BlueStyle, @"\b(abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b|#region\b|#endregion\b");
//clear folding markers
e.ChangedRange.ClearFoldingMarkers();
//set folding markers
e.ChangedRange.SetFoldingMarkers("{", "}");//allow to collapse brackets block
e.ChangedRange.SetFoldingMarkers(@"#region\b", @"#endregion\b");//allow to collapse #region blocks
e.ChangedRange.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block
}
示例6: PPLSyntaxHighlight
private void PPLSyntaxHighlight(TextChangedEventArgs e)
{
e.ChangedRange.SetStyle(_blueStyle,
//available actions
@"\b(when|and|or)\b",
RegexOptions.IgnoreCase | RegexCompiledOption);
}
示例7: SearchBar_OnTextChanged
/// <summary>
/// This is a temp implementation, make a server call when fully implemented
/// Source From https://blog.verslu.is/xamarin/finding-nemo-implementing-xamarin-forms-searchbar/
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">E.</param>
private async void SearchBar_OnTextChanged (object sender, TextChangedEventArgs e)
{
//todo : implement using server call
var people = peopleListview.ItemsSource as ObservableCollection<Person>;
if (people != null) {
if (_originalSource == null)
_originalSource = people;
peopleListview.IsRefreshing = true;
//Simulate long server call
await Task.Delay (TimeSpan.FromSeconds (2)).ContinueWith ((r) => {
// Device.BeginInvokeOnMainThread (() =>
// {
// if (string.IsNullOrWhiteSpace(e.NewTextValue))
// peopleListview.ItemsSource = _originalSource;
// else
// peopleListview.ItemsSource = new ObservableCollection<Person>(_originalSource.Where(p => p.FullName.ToLower ().Contains(e.NewTextValue.ToLower ())
// || p.PhoneNumber.Contains (e.NewTextValue)));
//
// peopleListview.IsRefreshing = false;
// });
});
}
}
示例8: host_TextChanged
private void host_TextChanged(object sender, TextChangedEventArgs e)
{
if (settings.ContainsKey("Host"))
settings["Host"] = host.Text;
else
settings.Add("Host", host.Text);
}
示例9: port_TextChanged
private void port_TextChanged(object sender, TextChangedEventArgs e)
{
if (settings.ContainsKey("Port"))
settings["Port"] = port.Text;
else
settings.Add("Port", port.Text);
}
示例10: ApplicantSearchTextBox_TextChanged
private void ApplicantSearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
filteredApplicants = new List<Person>();
var senderTextBox = (TextBox)sender;
if (senderTextBox.Text.Equals(""))
{
ApplicantsListView.ItemsSource = applicants;
}
foreach (var applicant in applicants)
{
if (applicant.FirstName.ToLower().Contains(senderTextBox.Text.ToLower())){
filteredApplicants.Add(applicant);
continue;
}
if (applicant.LastName.ToLower().Contains(senderTextBox.Text.ToLower())){
filteredApplicants.Add(applicant);
continue;
}
var fullName = applicant.FirstName + " " + applicant.LastName;
if (fullName.ToLower().Contains(senderTextBox.Text.ToLower())){
filteredApplicants.Add(applicant);
continue;
}
}
ApplicantsListView.ItemsSource = filteredApplicants;
}
示例11: ReplaceSeparatorChar
private async void ReplaceSeparatorChar(object sender, TextChangedEventArgs e)
{
double amount;
if (double.TryParse(TextBoxAmount.Text, out amount))
{
// todo: this try should be removeable, will see after the next version.
try
{
//cursorpositon to set the position back after the formating
var cursorposition = TextBoxAmount.SelectionStart;
var formattedText =
Utilities.FormatLargeNumbers(amount);
cursorposition = AdjustCursorPosition(formattedText, cursorposition);
TextBoxAmount.Text = formattedText;
//set the cursor back to the last positon to avoid jumping around
TextBoxAmount.Select(cursorposition, 0);
}
catch (FormatException ex)
{
Insights.Report(new ExtendedFormatException(ex, TextBoxAmount.Text));
}
}
else if (string.Equals(TextBoxAmount.Text, Strings.HelloWorldText, StringComparison.CurrentCultureIgnoreCase)
||
string.Equals(TextBoxAmount.Text, Strings.HalloWeltText, StringComparison.CurrentCultureIgnoreCase))
{
await new MessageDialog(Strings.HelloWorldResponse).ShowAsync();
}
}
示例12: examWeightTextBox_TextChanged
private void examWeightTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (examWeightTextBox.Text != "")
{
((App)Application.Current).grades.examWeight = (Double.Parse(examWeightTextBox.Text)) / 100;
}
}
示例13: ValidatePhoneNumber
public static void ValidatePhoneNumber(object sender, TextChangedEventArgs e){
Entry phoneNumber = sender as Entry;
if (phoneNumber.Text == string.Empty)
return;
var numbers = Regex.Replace(phoneNumber.Text, @"\D", "");
if (numbers.Length <= 3)
{
phoneNumber.Text = numbers;
return;
}
if (numbers.Length <= 7){
phoneNumber.Text = string.Format("{0}-{1}", numbers.Substring(0, 3), numbers.Substring(3));
return;
}
phoneNumber.Text = String.Format(
"({0}) {1}-{2}",
numbers.Substring(0, 3),
numbers.Substring(3, 3),
numbers.Substring(6)
);
}
示例14: ColoredTextBox_TextChanged
void ColoredTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (this.Text.Length == 0)
this.Background = new SolidColorBrush(Colors.Pink);
else
this.Background = new SolidColorBrush(Colors.White);
}
示例15: fctb_TextChanged
private void fctb_TextChanged(object sender, TextChangedEventArgs e)
{
//clear old styles of chars
e.ChangedRange.ClearStyle(ellipseStyle);
//append style for word 'Babylon'
e.ChangedRange.SetStyle(ellipseStyle, @"\bBabylon\b", RegexOptions.IgnoreCase);
}