我有一個視圖,應該顯示信息並測試它我添加了testdata。但是,如果我爲屏幕空間添加太多項目,垂直滾動條不會出現。ListBox垂直滾動條不顯示(WPF)
這是我的XML代碼:
<UserControl x:Class="not relevant"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="not relevant"
mc:Ignorable="d"
Width="250">
<Border Background="{DynamicResource BG}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
<StackPanel>
<Grid>
<Label Height="30" Content="Geöffnete Designs" HorizontalContentAlignment="Center"></Label>
<Separator Background="DarkGray"/>
<ListBox Background="{DynamicResource BG}" BorderThickness="0" VerticalAlignment="Stretch" >
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
<ListBoxItem>
<Label Content="Hallo"></Label>
</ListBoxItem>
</ListBox>
</Grid>
</StackPanel>
</Border>
我嘗試添加一個滾動瀏覽器代替,但沒有正常工作。我做錯了什麼,或者我可能會遇到什麼問題?
很新的WPF中添加滾動瀏覽器。感謝您在編輯中的進一步解釋。應該可以閱讀一本書,而不是僅僅顯示代碼的教程而無需進一步解釋 – fbueckle
歡迎您,我們都開始了一次:)祝您好運,學習WPF –