private void TargetTextBox_LostFocus(object sender, RoutedEventArgs e) { if (TargetTextBox.Text.Equals("")) { TargetTextBox.AppendText("Search file name - example „TEXT.txt" + "\""); } }
private void TargetTextBox_DragOver(object sender, DragEventArgs e) { var point = e.GetPosition(TargetTextBox); var range = TargetTextBox.Document.GetRangeFromPoint(point, Windows.UI.Text.PointOptions.ClientCoordinates); TargetTextBox.Document.Selection.SetRange(range.StartPosition, range.EndPosition); TargetTextBox.Focus(FocusState.Keyboard); }
protected override void Write(LogEventInfo LogEvent) { // Start by formatting the text that we need string text = Layout.Render(LogEvent); // If we need to add a new line, do it if (AddNewLine) { text += Environment.NewLine; } // If we need to invoke if (TargetTextBox.InvokeRequired) { // If a handle has not been created for this TextBox if (!TargetTextBox.IsHandleCreated) { // Get the pointer/handle of the TextBox (is silently created if not) TargetTextBox.Invoke(new Action(() => { _ = TargetTextBox.Handle; })); } // If we need to append, use AppendText if (Append) { TargetTextBox.Invoke(new Action(() => TargetTextBox.AppendText(text))); } // Otherwise, replace the text else { TargetTextBox.Invoke(new Action(() => TargetTextBox.Text = text)); } } // Otherwise, do the same things without invoking else { if (!TargetTextBox.IsHandleCreated) { _ = TargetTextBox.Handle; } // If we need to append, use AppendText if (Append) { TargetTextBox.AppendText(text); } // Otherwise, replace the text else { TargetTextBox.Text = text; } } }
private void SetFocus_Click(object sender, RoutedEventArgs e) { TargetTextBox.Focus(FocusState.Programmatic); }
private void TargetTextBox_Initialized(object sender, EventArgs e) { TargetTextBox.AppendText("Search file name - example „TEXT.txt" + "\""); }