0
我的ScrollViewer無法正常工作。它被顯示,但它不按預期滾動。滾動條不響應
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Open"/>
<MenuItem Header="_Close"/>
<MenuItem Header="_Save"/>
</MenuItem>
</Menu>
<StackPanel></StackPanel>
</DockPanel>
<TextBox x:Name="txtWords" FontFamily="Consolas" FontSize="18" TextWrapping="Wrap" BorderThickness="0"/>
</StackPanel>
<StackPanel VerticalAlignment="Bottom" Background="#FFF0F0F0">
<TextBlock x:Name="WordCount" HorizontalAlignment="Left" FontSize="14" Text="hello" Foreground="#FFBB2B2B" Grid.Row="1" VerticalScrollBarVisibility="Visible"/>
<!--I have also set the visibility to auto. I have also put the textbox inside a scroll bar. The same issue still persists.-->
</StackPanel>
</Grid>
我已經包含了我所有的代碼。文本框WordCount是有問題的元素。
在此先感謝。
您的ScrollViewer標籤在哪裏? – Mandy8055
我已經將文本框放在滾動查看器標記中,並且仍然存在相同的問題。 @ Mandy8055 –
請看看這個網站來看看它。我想你在這裏丟失了一些東西:http://www.codearsenal.net/2012/08/wpf-scrollviewer-control-example.html#.WaWiQsgjFEY – Mandy8055