This is a migrated thread and some comments may be shown as answers.

Transition with Number Incrementer

2 Answers 63 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
Neo
Top achievements
Rank 1
Neo asked on 17 Nov 2010, 02:08 PM
Hi All,
I'm having trouble implementing the transition control with a simple number incrementer. I have an Up and Down arrow that I want to increment a textblock number with a rolling transition.

2 Answers, 1 is accepted

Sort by
0
Neo
Top achievements
Rank 1
answered on 17 Nov 2010, 04:23 PM
XAML:
<
telerik:RadTransitionControl x:Name="TransitionControl" >
    <telerik:RadTransitionControl.ContentTemplate>
        <DataTemplate>
            <StackPanel x:Name="Pager" Orientation="Horizontal">
                <TextBlock Height="40" HorizontalAlignment="Left" Margin="235,173,0,0" Name="txtIncrement" Text="{Binding Path=SelectedIndex}" VerticalAlignment="Top" Width="81" />
            </StackPanel>
        </DataTemplate>
    </telerik:RadTransitionControl.ContentTemplate>
    <telerik:RadTransitionControl.Transition>
        <telerikTransitions:SlideAndZoomTransition />
    </telerik:RadTransitionControl.Transition>
</telerik:RadTransitionControl>

Code Behind: 

public MainPage()
{
    InitializeComponent();
    this.pagerViewModel = new PagerViewModel();
    this.pagerViewModel.Pages = LoadPages();
    //this.Pager.DataContext = this.pagerViewModel;
    this.TransitionControl.DataContext = this.pagerViewModel;
    //this.txtIncrement.DataContext = this.pagerViewModel;
}
private void btnUp_Click(object sender, RoutedEventArgs e)
{
    this.pagerViewModel.SelectedIndex++;
}
private void btnDown_Click(object sender, RoutedEventArgs e)
{
    this.pagerViewModel.SelectedIndex--;
}

This code works without the transition control wrapped around the TextBlock... Is there a different technique to Binding? I cannot set the DataContext on the textblock itself becuase it say inaccessible. How do i bind to the transitioncontrol itself?
0
George
Telerik team
answered on 22 Nov 2010, 02:20 PM
Hello Neo,

I would suggest you to bind the DataContext of the RadTransitionControl to the SelectedIndex and leave the binding of the TextBlock with: Text={Binding} . This will update the content of the RadTransitionControl each time when the SelectedIndex is changed.

I hope this helps.

Best wishes,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
TransitionControl
Asked by
Neo
Top achievements
Rank 1
Answers by
Neo
Top achievements
Rank 1
George
Telerik team
Share this question
or