In this topic, you'll learn how to add images to the C1CoverFlow control in Design view, in XAML, and in code. Note that you would need to add your image(s) to the application before completing the following steps..
In Design View
Complete the following steps:
1. Add a C1CoverFlow control to your project and select the control in Design view.
2. Navigate to the Toolbox and double-click the Image icon to add the Image control to the C1CoverFlow control. If the Image control was not added to the control, you may need to move its markup between the C1CoverFlow tags in XAML view.
3. Select the Image control in Design view.
4. In the Properties window, click the Source ellipsis button.
The Choose Image dialog box opens.
5. Navigate to the location of your image, select the image file, and click Open to add the image to the Image control. You can also select the Add button to locate an image not listed in the dialog box.
In XAML
Complete the following steps:
1. Add a C1CoverFlow control so that the XAML appears similar to the following:
<my:C1CoverFlow c1ext:C1CoverFlow>
2. Place the following XAML between the <my:C1CoverFlow> and </my:C1CoverFlow> tags, replacing "YourImage.png" with the name of your image file:
<Image Height="100" Width="100" Source="YourImage.png"/>
In Code
Complete the following steps:
1. In XAML view, add "x:Name="C1CoverFlow1" to the <my:C1CoverFlow> tag so that the control will have a unique identifier for you to call in code.
2. Open the MainPage.xaml code page (either MainPage.xaml.csor MainPage.xaml.vb, depending on which language you've chosen for your project).
3. Import the following namespace:
Imports System.Windows.Media.Imaging
•C#
using System.Windows.Media.Imaging;
4. Add the following code beneath the InitializeComponent method:
' Create the Image control
Dim Image1 As New Image()
' Create a bitmap image and add your image as its source
Dim BitMapImage1 As New BitmapImage()
BitMapImage1.UriSource = New Uri("YourImage.png", UriKind.RelativeOrAbsolute)
' Add the bitmap image as the Image control's source
Image1.Source = BitMapImage1
'Add the Image control to the C1CoverFlow control
C1CoverFlow1.Items.Add(Image1)
•C#
// Create the Image control
Image Image1 = new Image();
// Create a bitmap image and add your image as its source
BitmapImage BitMapImage1 = new BitmapImage();
BitMapImage1.UriSource = new Uri("YourImage.png", UriKind.RelativeOrAbsolute);
// Add the bitmap image as the Image control's source
Image1.Source = BitMapImage1;
//Add the Image control to the C1CoverFlow control
C1CoverFlow1.Items.Add(Image1);
This Topic Illustrates the Following:
You've added an image to your application. If you run your application, the image will be included in the C1CoverFlow control.