Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on Win 8 app C#. I have one scenario.

I have two scroll viewer . One contain list view and another contain canvas. List view has 25 column and 200 rows. and canvas contain different shapes.

I need to synch both scroll viewer . Both scroll viewer need to move vertically synchronously.

I have tried following things

1)View change event: But this event cause some delay in vertical scrolling. I mean scroll viewer 1 will move then scroll viewer 2 will move.

2)ManupulationDelta and ManupulationMode to handle scrolling manually.
C#
private void ListView_ManipulationDelta_1(object sender, ManipulationDeltaRoutedEventArgs e)
        {
             double yposition = vsAllRows.VerticalOffset - (e.Delta.Translation.Y);
             vsAllRows.ScrollToVerticalOffset(yposition);
        }

But this cause perfomrmance issue on ListView control Because scrolling on Listview is not smooth.

3) I cant use this scenario in which i can take one scroll viewer Put grid inside the scroll viewer and list view in one column and canvas in other column due to some other requirement. Please check the sample code.
XML
<ScrollViewer Width="600" Background="Green">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="77*"/>
                    <ColumnDefinition Width="73*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0">
                    <Rectangle Height="500" Fill="Red"></Rectangle>
                    <Rectangle Height="500" Fill="Blue"></Rectangle>
                </StackPanel>
                <StackPanel Grid.Column="1">
                    <Rectangle Height="500" Fill="Blue"></Rectangle>
                    <Rectangle Height="500" Fill="Red"></Rectangle>
                  </StackPanel>
            </Grid>
        </ScrollViewer>



SQL
Any how i can synch both scroll viewer.

Thanks in Advance Triple G
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900