2011-12-09 16 views
0

ScrollViewに関する投稿を検索しても表示されない場合は、私と同じような例が見つかりませんでした。Scrollviewは表示されますが、スクロールできませんPage

以下のコードを参照すると、私のScrollViewは表示されますが、スクロールできません。私はそれを機能させるためにどの部分を変更する必要があるのだろうか?

<Page x:Class="Apps" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 

    Title="Apps"  
    VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="auto" Height="auto"> 

<ScrollViewer> 
    <StackPanel> 

    <Label Content="All applications stored on desktop computer" Height="28" Name="Label2" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center" Margin="5" /> 


      <Grid Margin ="10" HorizontalAlignment="Left" Name="gridApps" VerticalAlignment="Top" Width="auto"> 
       <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="150"/> 
        <ColumnDefinition Width="150" /> 
        <ColumnDefinition Width="150" /> 
        <ColumnDefinition Width="150" /> 
        <ColumnDefinition Width="150" /> 
        <ColumnDefinition Width="150" /> 
        <ColumnDefinition Width="150" /> 

       </Grid.ColumnDefinitions> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="*"/> 
       </Grid.RowDefinitions> 
      </Grid>  


    </StackPanel> 
    </ScrollViewer> 
    </Page> 
+0

の作品で高さ=「ここに値を」設定のように思えますか? RowDefintionに固定高さを設定するとどうなりますか? –

答えて

0

は、ScrollViewerのは、あなたのグリッドの内のコンテンツがある

<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="auto" verticalScrollBarVisibility="auto" Width="auto" Height="600"> 

    <StackPanel x:Name="stackStores" Orientation="Vertical" > 
3

ScrollViewerのコンテンツの幅または高さが独自の幅または高さよりも大きくなると、スクロールバーがスクロール可能になります。これを試してみて、あなたはそれが表示されます:

<ScrollViewer Name="scrollViewer" Margin="10" Width="100" Height="224" HorizontalScrollBarVisibility="Auto"> 
    <StackPanel Name="stackPanel" Width="200" /> 
</ScrollViewer> 
+0

はいStackPanelに高さを入れてみましたが、それは表示されています。しかし、私は動的にグリッドに値を設定しているので、StackPanelの高さをグリッドに基づいて自動的に設定したいと思っています。どのようにautoに設定すると同時にScrollViewerを動作させることができますか? –

+0

hmmm ...何か変なこと...グリッドにラベルを入れました: '

+0

同じことをしようとすると...)あなたのグリッドの) – Anthony

0

(私はこれはあなたの問題を解決わからない、が)あなたはこれを試していなかった念のために:

<ScrollViewer HorizontalScrollBarVisibility="Auto"> 

または

<ScrollViewer HorizontalScrollBarVisibility="Visible"> 

(2番目のオプションは少し速くなります)。

関連する問題