Take the following steps in Microsoft Expression Blend to create an image list using LEADTOOLS ImageViewer control.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Leadtools_Controls_Wpf="clr-namespace:Leadtools.Controls;assembly=Leadtools.Controls.Wpf"
x:Class="MyList.MainWindow"
x:Name="Window"
Title="MyList"
Width="640"
Height="480">
<Grid x:Name="LayoutRoot">
<Leadtools_Controls_Wpf:ImageViewer x:Name="_imageList" Margin="10" ItemSpacing="10,10" ItemSize="150,150" HorizontalAlignment="Left" Width="180" ItemBorderThickness="1" SelectedItemBackgroundColor="LightSkyBlue" Loaded="ImageViewer_Loaded">
<Leadtools_Controls_Wpf:ImageViewer.ViewLayout>
<Leadtools_Controls_Wpf:ImageViewerVerticalViewLayout Columns="1"/>
</Leadtools_Controls_Wpf:ImageViewer.ViewLayout>
<Leadtools_Controls_Wpf:ImageViewer.InteractiveModes>
<Leadtools_Controls_Wpf:ImageViewerSelectItemsInteractiveMode IsEnabled="True"/>
</Leadtools_Controls_Wpf:ImageViewer.InteractiveModes>
</Leadtools_Controls_Wpf:ImageViewer>
</Grid>
</Window>
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using System.IO;
using System.Windows;
namespace MyList
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
LeadSize _imageSize = LeadSize.Create(130, 130);
private void ImageViewer_Loaded(object sender, RoutedEventArgs e)
{
AddItem(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\NaturalFruits.jpg"));
AddItem(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Ani.gif"));
AddItem(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image2.jpg"));
AddItem(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Fruits.jpg"));
}
private void AddItem(string fileName)
{
using (RasterCodecs codecs = new RasterCodecs())
{
_imageList.BeginUpdate();
RasterImage rasterImage = codecs.Load(fileName);
LeadRect destRect = LeadRect.Create(0, 0, _imageSize.Width, _imageSize.Height);
LeadRect imageRect = ImageViewer.GetDestinationRectangle(
rasterImage.ImageWidth,
rasterImage.ImageHeight,
destRect,
ControlSizeMode.Fit,
ControlAlignment.Near,
ControlAlignment.Near);
RasterImage thumbnail = rasterImage.CreateThumbnail(
imageRect.Width,
imageRect.Height,
32,
RasterViewPerspective.TopLeft,
RasterSizeFlags.Resample);
ImageViewerItem item = new ImageViewerItem();
item.Image = thumbnail;
_imageList.Items.Add(item);
_imageList.EndUpdate();
}
}
}
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.