|
| 1 | +<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> |
| 2 | +<Page x:Class="MarqueeExperiment.Samples.MarqueeBehaviorSample" |
| 3 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors" |
| 6 | + xmlns:controls="using:CommunityToolkit.WinUI.Controls" |
| 7 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 8 | + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" |
| 9 | + xmlns:local="MarqueeExperiment.Samples" |
| 10 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 11 | + mc:Ignorable="d"> |
| 12 | + |
| 13 | + <StackPanel Padding="16"> |
| 14 | + <TextBlock FontWeight="Bold" |
| 15 | + Text="This Marquee will loop once when hovered." /> |
| 16 | + <controls:Marquee x:Name="Loop1Marquee" |
| 17 | + Background="Transparent" |
| 18 | + Behavior="Ticker" |
| 19 | + Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
| 20 | + FontSize="18" |
| 21 | + RepeatBehavior="1x" |
| 22 | + Speed="256"> |
| 23 | + <interactivity:Interaction.Behaviors> |
| 24 | + <interactivity:EventTriggerBehavior EventName="PointerEntered" |
| 25 | + SourceObject="{Binding ElementName=Loop1Marquee}"> |
| 26 | + <interactivity:CallMethodAction MethodName="StartMarquee" |
| 27 | + TargetObject="{Binding ElementName=Loop1Marquee}" /> |
| 28 | + </interactivity:EventTriggerBehavior> |
| 29 | + </interactivity:Interaction.Behaviors> |
| 30 | + </controls:Marquee> |
| 31 | + |
| 32 | + <TextBlock Margin="0,16,0,0" |
| 33 | + FontWeight="Bold" |
| 34 | + Text="This Marquee will loop while hovered and pause when not hovered." /> |
| 35 | + <controls:Marquee x:Name="MarqueeControl" |
| 36 | + Background="Transparent" |
| 37 | + Behavior="Looping" |
| 38 | + Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." |
| 39 | + FontSize="18" |
| 40 | + RepeatBehavior="Forever" |
| 41 | + Speed="96"> |
| 42 | + <interactivity:Interaction.Behaviors> |
| 43 | + <interactivity:EventTriggerBehavior EventName="PointerEntered" |
| 44 | + SourceObject="{Binding ElementName=MarqueeControl}"> |
| 45 | + <interactivity:CallMethodAction MethodName="StartMarquee" |
| 46 | + TargetObject="{Binding ElementName=MarqueeControl}" /> |
| 47 | + </interactivity:EventTriggerBehavior> |
| 48 | + <interactivity:EventTriggerBehavior EventName="PointerExited" |
| 49 | + SourceObject="{Binding ElementName=MarqueeControl}"> |
| 50 | + <interactivity:CallMethodAction MethodName="PauseMarquee" |
| 51 | + TargetObject="{Binding ElementName=MarqueeControl}" /> |
| 52 | + </interactivity:EventTriggerBehavior> |
| 53 | + </interactivity:Interaction.Behaviors> |
| 54 | + </controls:Marquee> |
| 55 | + </StackPanel> |
| 56 | +</Page> |
0 commit comments