Skip to content

Commit 29bcd00

Browse files
committed
WIP Replacing MarqueeText with Marquee using ContentPresenters and ContentControl base class
1 parent 25d5ba9 commit 29bcd00

26 files changed

+176
-223
lines changed

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Otherwise, you can clone the repo, open the `components` directory, navigate wit
2828
- [DataTable](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/DataTable/samples/DataTable.md)
2929
- [Extensions.DependencyInjection](https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/Extensions.DependencyInjection)
3030
- [MarkdownTextBlock](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/MarkdownTextBlock/samples/MarkdownTextBlock.md)
31-
- [MarqueeText](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/MarqueeText/samples/MarqueeText.md)
31+
- [Marquee](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/Marquee/samples/Marquee.md)
3232
- [Notifications](https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/Notifications)
3333
- [Ribbon](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/Ribbon/samples/Ribbon.md)
3434
- [RivePlayer](https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/RivePlayer/samples/RivePlayer.md)
File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Marquee
3+
author: Avid29
4+
description: A control for scrolling content in a marquee fashion.
5+
keywords: Marquee, Control
6+
dev_langs:
7+
- csharp
8+
category: Controls
9+
subcategory: StatusAndInfo
10+
experimental: true
11+
discussion-id: 231
12+
issue-id: 0
13+
icon: Assets/Marquee.png
14+
---
15+
16+
The Marquee control allows text or other content to scroll in a marquee fashion. The control is heavily templated and many changes can be made by modifying the style. The control can also be adjusted using the Speed, Behavior, RepeatBehavior, and Direction properties.
17+
18+
## Speed
19+
20+
The speed property determines how quickly the content moves in pixels per second. The speed can be adjusted mid-animation and handled continously.
21+
22+
## Behavior
23+
24+
The Marquee control has 3 behaviors
25+
26+
### Ticker
27+
28+
Ticker mode starts with all content off the screen then scrolls the content across across the screen. When the animation finishes in the mode no content will be on screen.
29+
30+
### Looping
31+
32+
Looping mode will begin with the start of the content fully in frame then scroll towards the end. When the end is reached it will loop back to the start of the content. Nothing will happen if the content fits in frame.
33+
34+
### Bouncing
35+
36+
Looping mode will begin with the start of the content fully in frame then scroll towards the end. When the end is reached it will bounce and scroll backwards to the start of the content. Nothing will happen if the content fits in frame.
37+
38+
## RepeatBehavior
39+
40+
The repeat behavior determines how many times the marquee will loop before the animation finishes. It can be a number of iteration, a duration, or forever.
41+
42+
## Direction
43+
44+
The default direction is left, meaning the content will move leftwards, but this can be changed to right, up, or down. Direction changed between left and right or up and down are handled continously, meaning that the animation will resume from its current position if changed between these directions.
45+
46+
> [!Sample MarqueeSample]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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.MarqueeSample"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="MarqueeExperiment.Samples"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d">
10+
11+
<StackPanel Padding="16">
12+
<controls:Marquee Behavior="{x:Bind ConvertStringToMarqueeBehavior(MQBehavior), Mode=OneWay}"
13+
Direction="{x:Bind ConvertStringToMarqueeDirection(MQDirection), Mode=OneWay}"
14+
FontSize="18"
15+
RepeatBehavior="Forever"
16+
Speed="{x:Bind MQSpeed, Mode=OneWay}">
17+
<controls:Marquee.ContentTemplate>
18+
<DataTemplate>
19+
<Button Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."/>
20+
</DataTemplate>
21+
</controls:Marquee.ContentTemplate>
22+
</controls:Marquee>
23+
</StackPanel>
24+
</Page>

components/MarqueeText/samples/MarqueeTextSample.xaml.cs renamed to components/Marquee/samples/MarqueeSample.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
using CommunityToolkit.WinUI.Controls;
66

7-
namespace MarqueeTextExperiment.Samples;
8-
[ToolkitSample(id: nameof(MarqueeTextSample), "MarqueeText", description: "A control for scrolling text in a marquee fashion.")]
7+
namespace MarqueeExperiment.Samples;
8+
9+
[ToolkitSample(id: nameof(MarqueeSample), "Marquee", description: "A control for scrolling content in a marquee fashion.")]
910
[ToolkitSampleNumericOption("MQSpeed", initial: 96, min: 48, max: 196, step: 1, Title = "Speed")]
1011
[ToolkitSampleMultiChoiceOption("MQDirection", "Left", "Right", "Up", "Down", Title = "Marquee Direction")]
1112
//[ToolkitSampleMultiChoiceOption("MarqueeRepeat", "Repeat", "Forever", "1x", "2x")]
@@ -14,9 +15,9 @@ namespace MarqueeTextExperiment.Samples;
1415
#else
1516
[ToolkitSampleMultiChoiceOption("MQBehavior", "Ticker", "Looping", Title = "Marquee Behavior")]
1617
#endif
17-
public sealed partial class MarqueeTextSample : Page
18+
public sealed partial class MarqueeSample : Page
1819
{
19-
public MarqueeTextSample()
20+
public MarqueeSample()
2021
{
2122
this.InitializeComponent();
2223
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))')" />
3+
<PropertyGroup>
4+
<ToolkitComponentName>Marquee</ToolkitComponentName>
5+
</PropertyGroup>
6+
7+
<!-- Sets this up as a toolkit component's sample project -->
8+
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />
9+
10+
</Project>

components/MarqueeText/src/CommunityToolkit.WinUI.Controls.MarqueeText.csproj renamed to components/Marquee/src/CommunityToolkit.WinUI.Controls.Marquee.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<Project>
22
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))')" />
33
<PropertyGroup>
4-
<ToolkitComponentName>MarqueeText</ToolkitComponentName>
5-
<Description>This package contains MarqueeText.</Description>
4+
<ToolkitComponentName>Marquee</ToolkitComponentName>
5+
<Description>This package contains Marquee.</Description>
66

77
<!-- Rns suffix is required for namespaces shared across projects. See https://github.com/CommunityToolkit/Labs-Windows/issues/152 -->
8-
<RootNamespace>CommunityToolkit.WinUI.Controls.MarqueeTextRns</RootNamespace>
8+
<RootNamespace>CommunityToolkit.WinUI.Controls.MarqueeRns</RootNamespace>
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<UpToDateCheckInput Remove="MarqueeText.xaml" />
13-
</ItemGroup>
14-
1511
<!-- Sets this up as a toolkit component's source project -->
1612
<Import Project="$(ToolingDirectory)\ToolkitComponent.SourceProject.props" />
1713

0 commit comments

Comments
 (0)