2012-04-26 10 views
5

Me gustaría tener una interfaz con 3 componentes uno al lado del otro. El primero sería un ListView y los otros dos serían Grids.El ScrollViewer no se desplaza

Dado que los componentes se desbordan a la derecha, quiero ponerlos en un ScrollViewer. No tuve éxito. Traté de hacer un ejemplo muy simple para probar, pero incluso el ejemplo falla.

<ScrollViewer Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400"> 
     <StackPanel Width="1200" Height="400" Orientation="Horizontal"> 
      <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
      <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
      <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
     </StackPanel> 
    </ScrollViewer> 

Como puede ver, ScrollViewer está dentro de una cuadrícula. ¿Qué extrañé?

Respuesta

8

intente ajustar a estas propiedades en el visor de desplazamiento: -

<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" ZoomMode="Disabled" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400"> 
    <StackPanel Width="1200" Height="400" Orientation="Horizontal"> 
     <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
     <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
     <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
    </StackPanel> 
</ScrollViewer> 

que me funciona normalmente!

+2

Funcionó. Debe ser hechicería ... ¡gracias! – Jonas

+0

me puede sugerir un método para desplazarse usando scrollviewer para la entrada táctil. –

Cuestiones relacionadas