WPF: What UI control Visual Stadio 2017 IDE use when comparing two files?

Jane Chen - Applied BioCode 21 Reputation points
2020-07-07T06:32:10.243+00:00

We need to a create new WPF tool to compare two files.
This compare tool shows the contents of two files line by line and indicates the difference in the same line.

First we create two ListViews to display both source file and target file.
So each ListView has its own vertical scroll bar and horizontal scroll bar.
What we notice is that if we scroll vertical bar in left list view and right list view does not scroll. So the line numbers are off each other. That is not we want.
We need one vertical scroll bar and both ListViews move together. So we always see the same line are aligned together.

In Visual Studio IDE 2017, comparing two files with different versions, it shows one vertical scroll bar on the right side of panel and left side panel does not show vertical scroll bar. Each panel has its own Horizonal scroll bar. When moving vertical scroll bar, it moves same lines of two files together. So the vertical bar is for both left and right panels.

we have posted question in the link:
we have got an excellent solution with two scroll bars moving together. The only limitation is that there are two vertical scroll bars.

We know Visual Studio IDE is an application of WPF. Just wonder what UI controls VS IDE 2017 uses for comparing two files? Thx!

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jane Chen - Applied BioCode 21 Reputation points
    2020-07-07T16:32:35.977+00:00

    We found the solution:

    Base on Daisy provides the solution in the link: https://video2.skills-academy.com/en-us/answers/questions/43474/wpf-how-to-make-two-panels-share-the-same-vertical.html

    In Load() event, if add following line at the end,

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
    .....
    sv1.VerticalScrollBarVisibility= ScrollBarVisibility.Hidden;

    }

    left panel vertical scroll bar is hidden and only right panel show vertical scroll bar. Moving vertical scroll bar, both panels are moving together.

    0 comments No comments