开发者

how to get scroll up/down or left/right event for scrollviewer/listbox in wp7

How to get scroll up/down or left/right event for scrollViewer/Listbox? I have following XAML. I would like to get notification when user scroll.

<ScrollViewer HorizontalScrollBarVisibility="Auto" Margin="0,6,-196,0" Height="Auto" Name="imageScroll">
    <Li开发者_开发技巧stBox 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>


Peter Torr has an excelent blog post which shows how to make a LazyListBox. The code for that shows how to detect if the listbox is being scrolled by detecting changes in the VisualStateGroup of the Listboxes underlying ScrollViewer.


in listbox , you can scroll down/up .

It My code , hope help you scroll left and right

<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>

Item appears to be to contain the wrong place

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜