An Image Viewer for use in C# projects, particularly for Windows 10 applications
IMPORTANT: Change the class in the xaml to be apart of your project, not the BryxImageViewer project!
Add the BryxImageViewer.xaml and BryxImageViewer.xaml.cs files to your project. In the example project, I added them to a controls folder that lives in the main project directory. Also, add the styles that live in the App.xaml
file to your project's App.xaml
. This will allow for the styling of the ContentDialog and the Button to look correctly. The button style is not needed. In fact, any styling can be used for it, but the ContentDialog styling is needed in order for then image to take up the whole dialog and for the dialog to operate correctly.
If you added it to a controls folder, you can import the folder by having xmlns:controls="using:BRYXImageViewer.Controls"
in the topmost tag of your page:
<Page
x:Class="BRYXImageViewer.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BRYXImageViewer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:BRYXImageViewer.Controls"
mc:Ignorable="d">
Then, in the rest of your xaml, you can put <controls:BryxImageViewer></controls:BryxImageViewer>
There are two requried properties when using this control: ImageSource
and ThumbnailSource
. In the example I just used the same picture, but some may want to use a shrunken-down version of the main image at a specific size.
You can also add the Foreground
property to the tag, and it will apply that color to the X button used for closing the image.
To close the image, you can either tap the image or tap the X button.
An example use of this in a page would look like this:
<controls:BryxImageViewer Margin="5" Foreground="Black"
ThumbnailSource="http://beginners-investing.com/images/learn-how-to-invest.jpg"
ImageSource="http://beginners-investing.com/images/learn-how-to-invest.jpg"/>
The example project as well as the control requires Windows 10
Robert Bond, robert.bond@bryx.com
BRYXImageViewer is available under the MIT license. See the LICENSE file for more info.