Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
WPF_Blend_display_an_image

Take the following steps to create and run a program in Microsoft Expression Blend to display an image using LEADTOOLS BitmapSourceViewer.

  1. Start Microsoft Expression Blend.
  2. Choose File->New->Project... from the menu.
  3. In the Create New Project dialog box, choose "Standard Application (.exe)" in the "Select a project type" field, and name  the project as "ImageBrowser". Then set language as Visual C# . 
  4. If desired, type a new location for your project or select a directory using the Browse button, and then choose OK.
  5. In the "Project" window to the right of the screen, right-click on the "References" folder, and select " Add Reference...". In the "Add Reference..." dialog box, select the ".NET" tab and browse to LEADTOOLS local directory " Program Files\LEAD Technologies\LEADTOOLS 16\Bin\Dotnet\Win32 " folder and select the following DLLs:
    • Leadtools.dll
    • Leadtools.Codecs.dll
    • Leadtools.ImageProcessing.SpecialEffects.dll
    • Leadtools.Windows.Controls.dll
    • Leadtools.Windows.Media.dll
    • Leadtools.Windows.Media.Effects.dll
    Click Select and then click OK to add the above DLLs to the application.
  6. Make sure Window1.xaml is in design view. From the Asset Library (on left side of the screen, left-click bottom   symbol for asset library). Choose Custom Controls->BitmapSourceViewer. 
  7. Place the cursor on the Window1 and draw a rectangular area of approximately 300x200 (Width x Height in pixels).
  8. In the "Properties" window to the right of the screen, scroll down to Miscellaneous-->Source.  Find an image to be displayed (For example: C:\Users\Public\Documents\LEADTOOLS Images\ImageProcessingDemo\NaturalFruits.jpg), copy the entire directory path and paste to the Source field. The image should be displayed in the Leadtools BitmapSourceViewer, you can adjust the size by changing the fields ScaleFactor or SizeMode

  9. Build, and Run the program to test it (Project-->Test Project or F5). [Window1.xaml]
    			<Window  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 x:Class="ImageBrowser.Window1" x:Name="Window" Title="Window1"  Width="640" Height="480" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> <Grid x:Name="LayoutRoot"><Leadtools_Windows_Controls:BitmapSourceViewer Margin="124,132,205,124" Content="BitmapSourceViewer" SizeMode="Stretch"><Leadtools_Windows_Controls:BitmapSourceViewer.Source><BitmapImage UriSource="C:\Users\Public\Documents\LEADTOOLS Images\ImageProcessingDemo\NaturalFruits.jpg"/></Leadtools_Windows_Controls:BitmapSourceViewer.Source></Leadtools_Windows_Controls:BitmapSourceViewer> </Grid></Window>