2011-07-13 3 views
0

Comment faire pour faire défiler haut/bas ou gauche/droite événement pour scrollViewer/Listbox? J'ai suivi XAML. Je voudrais recevoir une notification lorsque l'utilisateur fait défiler.comment faire défiler vers le haut/bas ou gauche/droite événement pour scrollviewer/listbox dans wp7

<ScrollViewer HorizontalScrollBarVisibility="Auto" Margin="0,6,-196,0" Height="Auto" Name="imageScroll"> 
    <ListBox x:Name="myListBox" Margin="12,0,0,0"> 
     <ListBox.ItemsPanel> 
      <ItemsPanelTemplate> 
       <StackPanel Orientation ="Horizontal" > 
        <StackPanel.RenderTransform> 
         <TranslateTransform X="0" /> 
        </StackPanel.RenderTransform> 

       </StackPanel> 
      </ItemsPanelTemplate> 
     </ListBox.ItemsPanel> 
     <ListBox.ItemTemplate> 
      <DataTemplate> 
       <StackPanel Orientation="Horizontal"> 
        <TextBlock Foreground="GreenYellow" FontSize="60" Text="{Binding name}"/> 
        <HyperlinkButton Content="EVTEN" NavigateUri="{Binding price}" Foreground="AliceBlue" FontSize="40" TextOptions.TextHintingMode="Animated"/> 
        <TextBlock Foreground="Red" Padding="30" FontSize="60" Text="{Binding price}"/> 
        <TextBlock Foreground="GreenYellow" FontSize="60" Text="{Binding description}"/> 
        <TextBlock Foreground="Red" Padding="30" FontSize="60" Text="{Binding calories}"/> 
       </StackPanel> 
      </DataTemplate> 
     </ListBox.ItemTemplate> 
    </ListBox> 
</ScrollViewer> 

Répondre

0

Peter Torr a un excelent blog post qui montre comment créer un LazyListBox. Le code pour cela montre comment détecter si la listbox est en train de défiler en détectant les changements dans le VisualStateGroup des Listboxes sous-jacentes ScrollViewer.

+0

Le bit LazyListBox compliqué, mais il fait mon travail. Merci! – masiboo

0

dans la zone de liste, vous pouvez faire défiler vers le haut/bas.

Il Mon code, espoir de vous aider à défiler vers la gauche et à droite

<ListBox x:Name="myListBox" Margin="12,0,0,0"> 
    <ListBox.ItemsPanel> 
     <ItemsPanelTemplate> 
      <StackPanel Orientation ="Horizontal" > 

      </StackPanel> 

      <!-- You can add item contain here --> 
     </ItemsPanelTemplate> 
    </ListBox.ItemsPanel> 

article semble contenir au mauvais endroit

Questions connexes