What wrong with this? Why do I see 2 labels?

5 posts, 0 answers
  1. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 30 Mar 2012 Link to this post



    Hi.. I'm trying to do a transition when the content of the label changes - but I'm seeing 2 labels.
    What am I doing wrong. The transition only works on the second label.
    thanks again!

     

     

    <sdk:Label x:Name="lblRegions" Content="Regions" FontSize="18" Foreground="Navy" FontFamily="Segoe UI" HorizontalAlignment="Center"/>

     

     

    <telerik:RadTransitionControl Content="{Binding Content, ElementName=lblRegions}" HorizontalAlignment="Center" Duration="00:00:02">

     

     

    <telerik:RadTransitionControl.Transition>

     

     

    <telerik:FlipWarpTransition/>

     

     

    </telerik:RadTransitionControl.Transition>

     

     

    </telerik:RadTransitionControl>

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 04 Apr 2012 Link to this post

    Hello Jon,

    From your sample code it seems that you are displaying the Content of the lblRegions in both - in the label itself and in the RadTransitionControl. This is the reason why you see the label twice.

    If you give us more details on what you want you want to animate and when, I would be able to give you some ideas how to achieve it. In general the RadTransitionControls is a ContentControl and behaves as such and just animate its content when one of its Content or ContentTemplate properties is changed. For more information how to use it, please refer to this article.

    Hope this helps.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Jon_BCV
    Jon_BCV avatar
    16 posts
    Member since:
    Mar 2012

    Posted 04 Apr 2012 Link to this post

    Hi..
    I'm just trying to animate the label content/text when I programmatically change it.
    Can you please provide sampel code?thanks
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 06 Apr 2012 Link to this post

    Hello,

    What I would suggest you is to place the Label control in the ContentTemplate of the RadTransitionControl and to bind its Content to the DataContext of the template. After that in your code, instead of changing the Label's content, just change the content of the transition control.

    Here is an example of the described idea, using the code you provided:

    <telerik:RadTransitionControl x:Name="lblRegions" Content="Regions" HorizontalAlignment="Center" Duration="00:00:02">
        <telerik:RadTransitionControl.ContentTemplate>
            <DataTemplate>
                <sdk:Label Content="{Binding}" FontSize="18" Foreground="Navy" FontFamily="Segoe UI" HorizontalAlignment="Center"/>
            </DataTemplate>
        </telerik:RadTransitionControl.ContentTemplate>
        <telerik:RadTransitionControl.Transition>
            <telerik:FlipWarpTransition/>
        </telerik:RadTransitionControl.Transition>
    </telerik:RadTransitionControl>

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Jon_BCV
    Jon_BCV avatar
    16 posts
    Member since:
    Mar 2012

    Posted 06 Apr 2012 Link to this post

    Thanks!!!!!!!!!!!!!!!
Back to Top
DevCraft banner