朋友,下面是我的代码。我不知道为什么我的滚动条不起作用。
<Window x:Class="Seris.Views.Help"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Help" Height="400" Width="400">
<DockPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="350" Width="372"><InlineUIContainer>
<Image Height="100" Width="100" RenderTransformOrigin="1.37,0.46" Source="../Images/help.jpg"/>
</InlineUIContainer><Run/><LineBreak/><Run Text="There are some validations on the Vehicle Form as below."/><LineBreak/><Run Text="P"/><Run Text="lease note that all the fields are mandatory."/><LineBreak/><Run/><LineBreak/><Run FontWeight="Bold" Text="Vehicle No"/><LineBreak/><Run Text="It should be always 7 character long con"/><Run Text="taining "/><Run Text="first 3 digits as alphabet in capital form and remaining 4 numerical. "/><LineBreak/><Run Text="i.e. GHI1234"/><LineBreak/><Run FontWeight="Bold" Text="Model"/><LineBreak/><Run Text="It can be anything except null."/><LineBreak/><Run Text="i.e. Fluid"/><LineBreak/><Run FontWeight="Bold" Text="Manufacturing Date"/><LineBreak/><Run Text="It should not be a future date."/><LineBreak/><Run FontWeight="Bold" Text="IU No"/><LineBreak/><Run Text="It must be 10 digit numerical number."/><LineBreak/><Run FontWeight="Bold" Text="Personnel Name"/><LineBreak/><Run Text="You must select Personnel Name from combo box."/><LineBreak/>
</TextBlock>
</ScrollViewer>
</DockPanel>
</Window>
答案 0 :(得分:1)
删除Height="350"
&amp;来自TextBlock的Width="372"
,这些阻止了ScrollViewer正常工作
如果要限制大小,可以根据需要将其应用于DockPanel或ScrollViewer。
因此,如果您将宽度或高度应用于TextBlock将限制元素的大小,并且ScrollViewer可能无法按预期工作。
另外,您也可以删除HorizontalAlignment="Left"
&amp;来自TextBlock的VerticalAlignment="Top"
因为它们可能也不是必需的