WPF Image with ScrollViewer in VB.NET

In this article you will learn how to create an application in which a Image work with ScrollViewer. we take a image control and ScrollViewer control in WPF.
  • 1803

In this article you will learn how to create an application in which a Image work with ScrollViewer. we take a image control and ScrollViewer control in WPF.

For example

Taking a image control and ScrollViewer control on the form from Toolbox.

The form looks like this.

1.gif
 

Figure 1.

XAML code

<Window x:Class="MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="MainWindow" Height="350" Width="525">

    <ScrollViewer

    x:Name="scrollViewImage"

    HorizontalScrollBarVisibility="Visible"

    VerticalScrollBarVisibility="Visible" >

        <Grid

      x:Name="gridImageContainer"

      Background="Gray"

      ShowGridLines="True">

            <Grid.ColumnDefinitions>

                <ColumnDefinition></ColumnDefinition>

            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>

                <RowDefinition></RowDefinition>

            </Grid.RowDefinitions>

            <Image

         Grid.Row="0" Grid.Column="0" Name="Image1"Source="/WpfApplication15;component/Images/flowers-image.jpg">

            </Image>

        </Grid>

    </ScrollViewer>

    </Window>

 

Now run the application and increase the ScrollViewer.


 

2.gif 

Figure 2.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.