Posted on Aug 17, 2011 (permalink)
<
Window
x:Class
=
"RadControlsWpfApp1.MainWindow"
xmlns
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik
"http://schemas.telerik.com/2008/xaml/presentation"
Title
"MainWindow"
Height
"700"
Width
"900"
Background
"Black"
>
Grid
Grid.Resources
DataTemplate
x:Key
"customItemTemplate"
StackPanel
Image
Source
"{Binding Path=Country}"
"150"
HorizontalAlignment
"Left"
Margin
"10,10,0,0"
Name
"image1"
Stretch
"Fill"
VerticalAlignment
"Top"
"200"
/>
Button
Content
"Show Details"
"23"
"btnDetail"
"75"
Foreground
"White"
Click
"btnDetail_Click"
Label
x:Name
"ID"
"{Binding Path=ID}"
></
</
telerik:RadCarousel
"sampleRadCarousel"
ItemTemplate
"{StaticResource customItemTemplate}"
"Transparent"
GotFocus
"sampleRadCarousel_GotFocus"
Reply
You may get any item in RadCarousel cast it to your object and then you may access any properties you need. For example: you can get the Employee's Age of the SelectedItem in RadCarousel as follows:
private
void
RadButton_Click(
object
sender, RoutedEventArgs e)
{
var item = (
this
.carousel.SelectedItem
as
Employee).Age.ToString();
MessageBox.Show(
"Selected employee is "
+ item +
" years old"
);
}
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
OleDbConnection oleCon =
new
OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataBase.mdb"
OleDbCommand oleComd =
OleDbCommand(
"Select * From tblMovie"
, oleCon);
DataSet dtst =
DataSet();
OleDbDataAdapter adpt =
OleDbDataAdapter();
oleCon.Open();
adpt.SelectCommand = oleComd;
adpt.Fill(dtst,
"emp"
sampleRadCarousel.ItemsSource = dtst.Tables[0].DefaultView;
Since you are binding to DataRows you have to gather the information from this row relatively to the RadCarousel's SelectedItem as demonstrated in the following MSDN article.
btnDetail_Click(
Obj =
.sampleRadCarousel.SelectedItem;
DataRow Row = ((DataRowView)Obj).Row;
"Selected ID is "
+ Row[
].ToString());
I have just tested the behavior when the RadCarouselPanel is bound to a DataTable and the snipper above works correctly by my side. I am attaching you the application which I used for testing. You may also submit a new support ticket and attach your project where we can see what might be wrong.
Back to Top
[ WPF Carousel Features | Documentation | Demos | Telerik TV | Self-Paced Trainer ]
UI controls for ASP.NET AJAX, MVC, WPF, Silverlight, Windows Forms and Windows Phone. Visual Studio productivity tools. Reporting and data layer solutions.
HTML5 / JavaScript tools for Web and Mobile applications
Functional, Performance, Load and Mobile Software Testing
CMS, Mobile Web, Ecommerce, Emarketing, Social Media
Project management software inspired by Agile best practices
It seems you haven't bookmarked any pages. Fix that by clicking the button below