System.Windows.Controls.TextBox

plainTextBox.jpg

It's easy to add a plain TextBox . . . just add it in a BeginComposite . . . EndComposite method call.

.AddAnything<TextBox, Grid>(2, 1)

You can even subscribe to the TextChanged event, like so:

.SubscribeEventOnChild<TextBox, Grid, TextChangedEventArgs>(2, 1, "TextChanged", (
(sender, e) => { MessageBox.Show("Text Changed Added Length: " + e.Changes.ToList().FirstOrDefault().AddedLength.ToString()); }))

You may even color the background of the TextBox. In this example, I have a separate Label with a powder blue background and then the TextBox with a light yellow background, a Silver pen, and a Rectangle Geometry.

coloredTextBox.jpg

TextBox txtBox = new TextBox();
txtBox.Width = 150D;
txtBox.Height = 39D;
txtBox.Margin = new Thickness(7, 5, 7, 5);
txtBox.Background = BrushExt.CreateGeometryBrush(Brushes.LightYellow, new Pen(){ Brush=Brushes.Silver, Thickness=.3 }, new RectangleGeometry(new Rect(1, 1, .9, .7)));

 . . .  then in BeginComposite . . . EndComposite, add the existing TextBox:

 .AddExisting<TextBox, Grid>(11, 3, txtBox)

Last edited May 29, 2014 at 6:02 AM by stagathome0069, version 10

Comments

No comments yet.