Hi.
I'm using the RadCarousel Control.
I have a List<BitmapImage> and when I add a BitmapImage to this list, I add a Image, with the BitmapImage as source to the RadCarousel.Items
But, instead of showing the actual image. It's showing a dot.
I've tryed to attach a sample project that reproduces my problem but I couldn't.
So follows my code:
XAML:
CS:
Thanks
I'm using the RadCarousel Control.
I have a List<BitmapImage> and when I add a BitmapImage to this list, I add a Image, with the BitmapImage as source to the RadCarousel.Items
But, instead of showing the actual image. It's showing a dot.
I've tryed to attach a sample project that reproduces my problem but I couldn't.
So follows my code:
XAML:
| <Window x:Class="radcarouseltest.MainWindow" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| Title="MainWindow" Height="350" Width="525" |
| xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> |
| <StackPanel> |
| <telerik:RadCarousel Name="carousel" FlowDirection="LeftToRight" VerticalAlignment="Center" |
| HorizontalAlignment="Center" HorizontalScrollBarVisibility="Disabled" /> |
| <Button Content="LoadImages" Click="Button_Click" /> |
| </StackPanel> |
| </Window> |
CS:
| using System; |
| using System.Collections.Generic; |
| using System.Windows; |
| using System.Windows.Controls; |
| using System.Windows.Media.Imaging; |
| using Microsoft.Win32; |
| namespace radcarouseltest |
| { |
| /// <summary> |
| /// Interaction logic for MainWindow.xaml |
| /// </summary> |
| public partial class MainWindow : Window |
| { |
| private const String ExtensionFilter = "(*.jpg)|*.jpg|(*.gif)|*.gif|(*.png)|*.png|(*.tif)|*.tif|(*.tiff)|*.tiff"; |
| private List<BitmapImage> imageList; |
| public MainWindow() |
| { |
| InitializeComponent(); |
| imageList = new List<BitmapImage>(); |
| } |
| private void Button_Click(object sender, RoutedEventArgs e) |
| { |
| OpenFileDialog dialog = new OpenFileDialog { RestoreDirectory = true, Filter = ExtensionFilter, Multiselect = true }; |
| if (dialog.ShowDialog() == true) |
| { |
| foreach (string fileName in dialog.FileNames) |
| { |
| BitmapImage myImage = new BitmapImage(new Uri(fileName, UriKind.Relative)); |
| imageList.Add(myImage); |
| updateCarousel(); |
| carousel.SelectedItem = carousel.Items[imageList.Count -1 ]; |
| } |
| } |
| } |
| private void updateCarousel() |
| { |
| carousel.Items.Clear(); |
| foreach (BitmapImage img in imageList) |
| { |
| Image myImage = new Image(); |
| myImage.Source = img; |
| carousel.Items.Add(myImage); |
| } |
| } |
| } |
| } |
Thanks