-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved MarqueeText control #548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass review. As discussed in call, we'll do a bit of cleanup before merging this in. There are layout and extensibility complexities here that we'll want to resolve later, but the new cycling functionality works quite well as-is and should be made available for others.
|
||
<Content Include="Assets\MarqueeText.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove this since it's done automatically by our tooling
@@ -17,9 +17,17 @@ | |||
|
|||
<ItemGroup> | |||
<None Remove="Assets\MarqueeText.png" /> | |||
<None Remove="CustomStyleMarqueeTextSample.xaml" /> | |||
<UpToDateCheckInput Remove="CustomStyleMarqueeTextSample.xaml" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove this since it's done automatically by our tooling
//[ToolkitSampleMultiChoiceOption("MarqueeRepeat", "Repeat", "Forever", "1x", "2x")] | ||
public sealed partial class CustomStyleMarqueeTextSample : Page | ||
{ | ||
private const string LoremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be an area to improve our tooling -- ToolkitSampleTextOption
should take a default value for the text.
this.InitializeComponent(); | ||
} | ||
|
||
private MarqueeDirection ConvertStringToMarqueeDirection(string str) => str switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the value of each string here matches the enum value name, we shouldn't need a converter. If this doesn't work, it's something we need to investigate fixing.
@@ -71,7 +78,8 @@ protected override void OnApplyTemplate() | |||
_marqueeContainer = (Panel)GetTemplateChild(MarqueeContainerPartName); | |||
_segment1 = (FrameworkElement)GetTemplateChild(Segment1PartName); | |||
_segment2 = (FrameworkElement)GetTemplateChild(Segment2PartName); | |||
_marqueeTransform = (TranslateTransform)GetTemplateChild(MarqueeTransformPartName); | |||
_marqueeTransform = (CompositeTransform)GetTemplateChild(MarqueeTransformPartName); | |||
_cyclingStoryboard = (Storyboard)GetTemplateChild(CyclingAnaimationPartName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo
} | ||
|
||
// Create new storyboard and animation | ||
_marqueeStoryboard = CreateMarqueeStoryboardAnimation(start, end, duration, targetProperty); | ||
_marqueeStoryboard = Behavior switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider the ways we can generalize this control so differences like this are handled in the style template instead of internally in the control. Might be a bit of work, but now that things are working under a variety of configurations it would be a good thing to do.
@michael-hawker Not here or now, but we should consider the advantages we'd get building this on I don't have experience with building a custom layout with ItemsRepeater, so any insight you could add here would be valuable. |
cbb80a6
to
01d7292
Compare
Changes:
Added Cycle Marquee Behavior option
When in cycle mode, an animation is played to transition between values when the
Text
property is changed.MarqueeCycle-Example.mp4
More predictable behavior