Skip to content
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

[Proposal] IViewSwitcher #123

Open
1 of 10 tasks
TheCodeTraveler opened this issue Sep 29, 2021 · 0 comments
Open
1 of 10 tasks

[Proposal] IViewSwitcher #123

TheCodeTraveler opened this issue Sep 29, 2021 · 0 comments
Labels
new proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail

Comments

@TheCodeTraveler
Copy link
Collaborator

ViewSwitcher

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests: Not Started
  • Sample: Not Started
  • Documentation: Not Started

Summary

Allows transitions between VisualElement

Detailed Design

IViewSwitcher.shared.cs

interface IViewSwitcher
{
  uint TransitionDuration { get; set; }
  TransitionType TransitionType { get; set; }
}

ImageSwitcher.shared.cs

class ImageSwitcher : Image, IViewSwitcher
{
  public static readonly BindableProperty TransitionDurationProperty;
  public static readonly BindableProperty TransitionTypeProperty;
  
  public uint TransitionDuration { get; set; }
  public TransitionType TransitionType { get; set; }
}

TextSwitcher.shared.cs

public class TextSwitcher : Label, IViewSwitcher
{
  public static readonly BindableProperty TransitionDurationProperty;
  public static readonly BindableProperty TransitionTypeProperty;
  
  public uint TransitionDuration { get; set; }
  public TransitionType TransitionType { get; set; }
}

TransitionType.shared.cs

public enum TransitionType { Fade, MoveInFromLeft }

Usage Syntax

XAML Usage

<StackLayout HorizontalOptions="CenterAndExpand">
  <xct:TextSwitcher
      x:Name="switcher"
      TextColor="Black"
      FontSize="30"
      Text="Random Text" />
  <Button Text="Update Text"
          CommandParameter="{x:Reference switcher}"
          Command="{Binding UpdateTextCommand, Source={x:Reference page}}" />
</StackLayout>

C# Usage

Content = new StackLayout
{
  new TextSwitcher
  { 
    Text = "Random Text",
    FontSize = 30,
    TextColor = Colors.Black,
  }.Assign(out var switcher),

  new Button
  {
    CommandParameter = switcher,
    Command = new Command<TextSwitcher>(textSwitcher => textSwitcher.Text = Path.GetRandomFileName())
  }
};
@TheCodeTraveler TheCodeTraveler added new proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail labels Sep 29, 2021
@TheCodeTraveler TheCodeTraveler added this to the v1.0.0 milestone Sep 29, 2021
@TheCodeTraveler TheCodeTraveler removed this from the v1.0.0 milestone Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail
Projects
None yet
Development

No branches or pull requests

1 participant