Tuesday, October 20, 2009

Infragistics xamDataCarousel - Part 2


In part 1 of this article I introduced a simple example to demonstrate the xamDataCarousel control and the usage. In this post I’ll show how to get the details of the active record selected on the control items.
For getting the details from the current selected record, we can use the WPF data binding features as in the code sample given below.
<StackPanel Grid.Row="2" Grid.Column="1" DataContext="{Binding ElementName=sampleDataCarousel, Path=ActiveRecord}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        Grid.RowDefinitions>
        <TextBlock Text="Name :" FontWeight="Bold" Margin="0 0 0 5" HorizontalAlignment="Right" />
        <TextBlock Text="Current Department :" FontWeight="Bold" Grid.Row="1" Margin="0 0 0 5" HorizontalAlignment="Right" />
        <TextBlock Text="Salary Earned :" FontWeight="Bold" Grid.Row="2" Margin="0 0 0 5" HorizontalAlignment="Right" />
        <TextBlock Text="Calculated Bonus :" FontWeight="Bold" Grid.Row="3" Margin="0 0 0 5" HorizontalAlignment="Right" />
        <TextBlock Text="Email Address :" FontWeight="Bold" Grid.Row="4" Margin="0 0 0 5" HorizontalAlignment="Right" />
        <TextBlock Text="{Binding Path=Cells[Name].Value}" HorizontalAlignment="Left" Margin="5 0 0 0" Grid.Column="1" Grid.Row="0" />
        <TextBlock Text="{Binding Path=Cells[Department].Value}" HorizontalAlignment="Left" Margin="5 0 0 0" Grid.Column="1" Grid.Row="1" />
        <TextBlock Text="{Binding Path=Cells[Salary].Value}" HorizontalAlignment="Left" Margin="5 0 0 0" Grid.Column="1" Grid.Row="2" />
        <TextBlock Text="{Binding Path=Cells[Bonus].Value}" HorizontalAlignment="Left" Margin="5 0 0 0" Grid.Column="1" Grid.Row="3" />
        <TextBlock Text="{Binding Path=Cells[Email].Value}" HorizontalAlignment="Left" Margin="5 0 0 0" Grid.Column="1" Grid.Row="4" />
    Grid>
StackPanel>

 

No comments: