TextBox (Multi-Line) Example


If screen real estate is not an issue, and so you just need a regular textbox with multi-line text and a scrollbar, you may use the regular WPF TextBox initialized for ScrollViewer support (to allow accessing the Scrollbar which may then have its colors modified by the ApplyToScrollViewer method.)

See Extended WPF Toolkit™ Community Edition MultiLineTextEditor if screen real estate is an issue.

#region Setup Multi-Line TextBox with styled ScrollViewer

TextBox trex = new TextBox(); 
trex.InitializeForScrollViewerSupport(100D, 150D, 140D);  //TextBox is NOT an IParent but it is an IScrollViewerStrategy.
ScrollViewerStyle.ApplyToScrollViewer<TextBox>(trex, "PowderBlue", "White", "Blue");
trex.Text = "This is an example\n of a\n multi-line textbox with enough text in it to trigger the vertical scrollbar to display.";


Last edited May 26, 2014 at 4:58 AM by stagathome0069, version 3


No comments yet.