Transition with Number Incrementer

3 posts, 0 answers
  1. Neo
    Neo avatar
    30 posts
    Member since:
    May 2009

    Posted 17 Nov 2010 Link to this post

    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. Neo
    Neo avatar
    30 posts
    Member since:
    May 2009

    Posted 17 Nov 2010 Link to this post

    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?
  3. DevCraft banner
  4. George
    Admin
    George avatar
    1332 posts

    Posted 22 Nov 2010 Link to this post

    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
Back to Top