WPF C# Tutorial – Make a simple image gallery in visual studio
- Subject: WPF C# Tutorials
- Learning Time: 1 hour
In this tutorial we will show you how to make a simple image gallery in visual studio with C# and WPF. This app is designed to show you how to import images into WPF, how to access them and how to present them in the form so it shows up on run time. Some people had problems where the images shows up during the design view but does not show up on runtime, these issues can be frustrating for beginners because we just want to make something work and then check how it worked right, so with this tutorial we will show you how to make simple image gallery in WPF and C#. You can download the images that we are using with this project and use in your own, also you can get your own images if you want to.
C# Flappy Bird Hunting Game MasterClass
Create a interactive shooting game with Flappy Birds
- Use OOP to make the game
- Backgrounds and Play Music
- Work with Multiple Forms
- & Much more ..
In this new course we will recreate the very popular game with a twist. We will create this game from an empty project to a fully compiled EXE file using Visual Studio. Click here to see the full course details.
Lesson objective –
- Make a simple slide show image gallery in visual studio with WPF and C#.
- Using GRID display in XAML to make this app
- Use XAML code to insert necessary tags to make this app work
- Use C# code to program events with buttons
- Using button events to change the pictures inside of WPF C#
- Import images to the project solutions the right way so they show up on runtime.
- Debug and test the program
Full Video Tutorial
Written tutorial and Source Code Below –
To start, lets make a new project in visual studio. Under the C# WPF name the project image gallery and press OK.
Lets download the images we need for this project and import them to the project solutions.
These are the six cute kitten images we are going to use. If you notice, we have named them 1-6 and they are all JPG files. This part is important because want to be able to load JPG files with the program and change the values through C# script later.
First right click on the image gallery name inside the solutions explorer, hover over the add option and click on the folder. We will need to add a folder so we can import our images into it.
Now name the folder “pics” and press enter.
Above you can see that we have made the pics folder.
Now right click on the folder, hover over the add option and click on the existing item option.
Now navigate to where the images are saved, select all files from the file type option in the browser. Select all of the images and click ADD.
Now they are all imported to the project. It is possible for us to access these files in the design and the runtime views. Lets get started with coding. Go to the second page to start with coding for this app.