When using Silverlight to generate a list that interacts with the server, you may encounter a scroll bar that I did not expect in Web development.
In IE, ie will automatically display the scroll bar with a larger page size. Therefore, Web developers once developed never bother to show the scroll bar. Generally, we want IE to not automatically display the scroll bar, however, when developing Silverlight, we will find that when your content has exceeded the size of the Silverlight container or control, it is not actually a scroll bar, and the content beyond your range will be hidden.
For normal experience development, your content may be completely controlled by you and this will not happen. However, if it is a generated list, the number of rows of the List is dynamically obtained through the server, this will be more important. Even the Textbox Control that does not need to consider scrolling in the Web will not automatically display the scroll bar in Silverlight.
In Silverlight, the scroll bar control is called scrollviewer independently as a container. For more information, see the Silverlight documentation.
Other container controls, such as Textbox, have the horizontalscrollbarvisibility and verticalscrollbarvisibility attributes to control whether to enable the scroll bar function.
The following small example shows how to make the Silverlight document display the scroll bar and the textbox text display the scroll bar.
<Usercontrol xmlns: Basics = "CLR-namespace: system. windows. controls; Assembly = system. windows. controls "xmlns: Data =" CLR-namespace: system. windows. controls; Assembly = system. windows. controls. data "X: class =" silverlighttest. page"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Width = "400" Height = "300">
<Scrollviewer horizontalscrollbarvisibility = "visible" verticalscrollbarvisibility = "visible">
<Grid X: Name = "layoutroot" background = "black">
& Lt; textbox margin = "00,200, 300 "text =" a text box that demonstrates visibility and verticalscrollbarvisibility "width =" 100 "Height =" "acceptsreturn =" true "visibility =" visible "verticalscrollbarvisibility =" visible "/>
</GRID>
</Scrollviewer>
</Usercontrol>
The acceptsreturn attribute of textbox is to get or set a value, which determines whether the text box allows and displays line breaks or carriage returns.
True if the text box allows line breaks; otherwise, false. The default value is false. (I tested it in silverlight2. It seems that the default value is true. I don't know if it is wrong in the Silverlight document)
Reprinted from http://hi.baidu.com/gookings/blog/item/d4ab9dcb5f9f6bf552664fda.html, 3q]