Merge pull request #7 from dotnet/update-status

Updated STATUS documentation
This commit is contained in:
Javier Suárez 2021-02-08 09:36:08 +01:00 коммит произвёл GitHub
Родитель f762609969 372a743c90
Коммит 03cce52ef6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 234 добавлений и 72 удалений

123
STATUS.md
Просмотреть файл

@ -14,58 +14,60 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| Color | ⚠️ | ⚠️ | ⚠️ |
| IsRunning | ⚠️ | ⚠️ | ⚠️ |
| Color | ✅ | ✅ | ✅ |
| IsRunning | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| RTL Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | |
### ⚠️ BoxView
**Properties**
| API | Description |
| ----|:-------:|
| Color | ⚠️ |
| CornerRadius | ⚠️ |
| Color | |
| CornerRadius | |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| RTL Support | ⚠️ |
| RTL Support | |
### ⚠️ Button
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| BackgroundColor | ⚠️ | ⚠️ | ⚠️ |
| BackgroundColor | ✅ | ✅ | ✅ |
| BorderColor | ⚠️ | ⚠️ | ⚠️ |
| BorderWidth | ⚠️ | ⚠️ | ⚠️ |
| CharacterSpacing | ⚠️ | ⚠️ | ⚠️ |
| Clicked | ⚠️ | ⚠️ | ⚠️ |
| Command | ⚠️ | ⚠️ | ⚠️ |
| CommandParameter | ⚠️ | ⚠️ | ⚠️ |
| Clicked | ✅ | ✅ | ✅ |
| Command | ✅ | ✅ | ✅ |
| CommandParameter | ✅ | ✅ | ✅ |
| ContentLayout | ⚠️ | ⚠️ | ⚠️ |
| CornerRadius | ⚠️ | ⚠️ | ⚠️ |
| CornerRadius | ✅ | ✅ | ✅ |
| FontAttributes | ⚠️ | ⚠️ | ⚠️ |
| FontFamily | ⚠️ | ⚠️ | ⚠️ |
| FontSize | ⚠️ | ⚠️ | ⚠️ |
| ImageSource | ⚠️ | ⚠️ | ⚠️ |
| Padding | ⚠️ | ⚠️ | ⚠️ |
| Text | ⚠️ | ⚠️ | ⚠️ |
| Pressed | ✅ | ✅ | ✅ |
| Released | ✅ | ✅ | ✅ |
| Text | ✅ | ✅ | ✅ |
| TextColor | ⚠️ | ⚠️ | ⚠️ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ CheckBox
@ -73,15 +75,15 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| Color | ⚠️ | ⚠️ | ⚠️ |
| CheckedChanged | ⚠️ | ⚠️ | ⚠️ |
| IsChecked | ⚠️ | ⚠️ | ⚠️ |
| Color | ✅ | ✅ | ✅ |
| CheckedChanged | ✅ | ✅ | ✅ |
| IsChecked | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ DatePicker
@ -89,6 +91,7 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| BackgroundColor | ✅ | ✅ | ✅ |
| CharacterSpacing | ⚠️ | ⚠️ | ⚠️ |
| Date | ⚠️ | ⚠️ | ⚠️ |
| DateSelected | ⚠️ | ⚠️ | ⚠️ |
@ -113,14 +116,14 @@ Here you find a list of all controls with their (public) APIs and their status.
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| AutoSize | ⚠️ | ⚠️ | ⚠️ |
| Completed | ⚠️ | ⚠️ | ⚠️ |
| Completed | ✅ | ✅ | ✅ |
| CharacterSpacing | ⚠️ | ⚠️ | ⚠️ |
| FontAttributes | ⚠️ | ⚠️ | ⚠️ |
| FontFamily | ⚠️ | ⚠️ | ⚠️ |
| FontSize | ⚠️ | ⚠️ | ⚠️ |
| IsReadOnly | ⚠️ | ⚠️ | ⚠️ |
| IsTextPredictionEnabled | ⚠️ | ⚠️ | ⚠️ |
| Text | ⚠️ | ⚠️ | ⚠️ |
| Text | ✅ | ✅ | ✅ |
| TextColor | ⚠️ | ⚠️ | ⚠️ |
| MaxLength | ⚠️ | ⚠️ | ⚠️ |
@ -128,7 +131,7 @@ Here you find a list of all controls with their (public) APIs and their status.
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ Entry
@ -146,31 +149,31 @@ Here you find a list of all controls with their (public) APIs and their status.
| HorizontalTextAlignment | ⚠️ | ⚠️ | ⚠️ |
| IsTextPredictionEnabled | ⚠️ | ⚠️ | ⚠️ |
| IsPassword | ⚠️ | ⚠️ | ⚠️ |
| PlaceHolder | ⚠️ | ⚠️ | ⚠️ |
| PlaceHolder | ✅ | ✅ | ✅ |
| PlaceHolderColor | ⚠️ | ⚠️ | ⚠️ |
| VerticalTextAlignment | ⚠️ | ⚠️ | ⚠️ |
| ReturnCommand | ⚠️ | ⚠️ | ⚠️ |
| ReturnCommandParameter | ⚠️ | ⚠️ | ⚠️ |
| ReturnType | ⚠️ | ⚠️ | ⚠️ |
| SelectionLength | ⚠️ | ⚠️ | ⚠️ |
| Text | ⚠️ | ⚠️ | ⚠️ |
| Text | ✅ | ✅ | ✅ |
| TextColor | ⚠️ | ⚠️ | ⚠️ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| RTL Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | |
### ⚠️ Frame
**Properties**
| API | Status |
| ----|:-------:|
| BorderColor | ⚠️ |
| CornerRadius | ⚠️ |
| HasShadow | ⚠️ |
| BorderColor | |
| CornerRadius | |
| HasShadow | |
**Features**
| Feature | Description |
@ -184,15 +187,15 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| Progress | ⚠️ | ⚠️ | ⚠️ |
| ProgressColor | ⚠️ | ⚠️ | ⚠️ |
| ProgressTo | ⚠️ | ⚠️ | ⚠️ |
| Progress | ✅ | ✅ | ✅ |
| ProgressColor | ✅ | ✅ | ✅ |
| ProgressTo | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ RadioButton
@ -200,15 +203,15 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| CheckedChanged | ⚠️ | ⚠️ | ⚠️ |
| GroupName | ⚠️ | ⚠️ | ⚠️ |
| IsChecked | ⚠️ | ⚠️ | ⚠️ |
| CheckedChanged | ✅ | ✅ | ✅ |
| GroupName | ✅ | ✅ | ✅ |
| IsChecked | ✅ | ⚠️ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ Slider
@ -216,23 +219,23 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| DragCompleted | ⚠️ | ⚠️ | ⚠️ |
| DragCompletedCommand | ⚠️ | ⚠️ | ⚠️ |
| DragStarted | ⚠️ | ⚠️ | ⚠️ |
| DragStartedCommand | ⚠️ | ⚠️ | ⚠️ |
| Maximum | ⚠️ | ⚠️ | ⚠️ |
| MaximumTrackColor | ⚠️ | ⚠️ | ⚠️ |
| Minimum | ⚠️ | ⚠️ | ⚠️ |
| MinimumTrackColor | ⚠️ | ⚠️ | ⚠️ |
| ThumbColor | ⚠️ | ⚠️ | ⚠️ |
| Value | ⚠️ | ⚠️ | ⚠️ |
| ValueChanged | ⚠️ | ⚠️ | ⚠️ |
| DragCompleted | ✅ | ✅ | ✅ |
| DragCompletedCommand | ✅ | ✅ | ✅ |
| DragStarted | ✅ | ✅ | ✅ |
| DragStartedCommand | ✅ | ✅ | ✅ |
| Maximum | ✅ | ✅ | ✅ |
| MaximumTrackColor | ✅ | ✅ | ✅ |
| Minimum | ✅ | ✅ | ✅ |
| MinimumTrackColor | ✅ | ✅ | ✅ |
| ThumbColor | ✅ | ✅ | ✅ |
| Value | ✅ | ✅ | ✅ |
| ValueChanged | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ Stepper
@ -240,34 +243,33 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| Increment | ⚠️ | ⚠️ | ⚠️ |
| Maximum | ⚠️ | ⚠️ | ⚠️ |
| Minimum | ⚠️ | ⚠️ | ⚠️ |
| Value | ⚠️ | ⚠️ | ⚠️ |
| ValueChanged | ⚠️ | ⚠️ | ⚠️ |
| StepperPosition | ⚠️ | ⚠️ | ⚠️ |
| Increment | ✅ | ✅ | ✅ |
| Maximum | ✅ | ✅ | ✅ |
| Minimum | ✅ | ✅ | ✅ |
| Value | ✅ | ✅ | ✅ |
| ValueChanged | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| RTL Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | |
### ⚠️ Switch
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| IsToggled | ⚠️ | ⚠️ | ⚠️ |
| OnColor | ⚠️ | ⚠️ | ⚠️ |
| ThumbColor | ⚠️ | ⚠️ | ⚠️ |
| IsToggled | ✅ | ✅ | ✅ |
| OnColor | ✅ | ✅ | ✅ |
| ThumbColor | ✅ | ✅ | ✅ |
**Features**
| Feature | Description |
| ----|:-------:|
| Accesibility Support | ⚠️ |
| Dark Theme Support | ⚠️ |
| Dark Theme Support | |
| RTL Support | ⚠️ |
### ⚠️ TimePicker
@ -275,6 +277,7 @@ Here you find a list of all controls with their (public) APIs and their status.
**Properties**
| API | Cupertino | Fluent | Material |
| ----|:-------:|:---:|:-----:|
| BackgroundColor | ✅ | ✅ | ✅ |
| CharacterSpacing | ⚠️ | ⚠️ | ⚠️ |
| FontAttributes | ⚠️ | ⚠️ | ⚠️ |
| FontFamily | ⚠️ | ⚠️ | ⚠️ |

Просмотреть файл

@ -1,6 +1,8 @@
using System;
using System.ComponentModel;
using System.Graphics;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using GraphicsControls.Effects;
using Xamarin.Forms;
using Point = System.Graphics.Point;
@ -8,7 +10,7 @@ using XColor = Xamarin.Forms.Color;
namespace GraphicsControls
{
public partial class Button : GraphicsVisualView, ICornerRadius
public partial class Button : GraphicsVisualView, IButton, ICornerRadius
{
readonly RippleEffect _rippleEffect;
RectangleF _backgroundRect;
@ -23,12 +25,35 @@ namespace GraphicsControls
CornerRadius = 2;
}
public static readonly BindableProperty CommandProperty = ButtonElement.CommandProperty;
public static readonly BindableProperty CommandParameterProperty = ButtonElement.CommandParameterProperty;
internal static readonly BindablePropertyKey IsPressedPropertyKey =
BindableProperty.CreateReadOnly(nameof(IsPressed), typeof(bool), typeof(Button), default(bool));
public static readonly BindableProperty IsPressedProperty = IsPressedPropertyKey.BindableProperty;
public static readonly BindableProperty TextProperty = TextElement.TextProperty;
public static readonly BindableProperty TextColorProperty = TextElement.TextColorProperty;
public static readonly BindableProperty CornerRadiusProperty = CornerRadiusElement.CornerRadiusProperty;
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
public bool IsPressed => (bool)GetValue(IsPressedProperty);
public string Text
{
get { return (string)GetValue(TextElement.TextProperty); }
@ -47,6 +72,26 @@ namespace GraphicsControls
set { SetValue(CornerRadiusElement.CornerRadiusProperty, value); }
}
bool IButton.IsEnabledCore
{
set { SetValueCore(IsEnabledProperty, value); }
}
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.SetIsPressed(bool isPressed) => SetValue(IsPressedPropertyKey, isPressed);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpClicked() => Clicked?.Invoke(this, EventArgs.Empty);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpPressed() => Pressed?.Invoke(this, EventArgs.Empty);
[EditorBrowsable(EditorBrowsableState.Never)]
void IButton.PropagateUpReleased() => Released?.Invoke(this, EventArgs.Empty);
void IButton.OnCommandCanExecuteChanged(object sender, EventArgs e) =>
ButtonElement.CommandCanExecuteChanged(this, EventArgs.Empty);
public event EventHandler Clicked;
public event EventHandler Pressed;
public event EventHandler Released;
@ -102,6 +147,7 @@ namespace GraphicsControls
}
Pressed?.Invoke(this, EventArgs.Empty);
Clicked?.Invoke(this, EventArgs.Empty);
}

Просмотреть файл

@ -1,4 +1,5 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using System.Graphics;
using System.Runtime.CompilerServices;
using GraphicsControls.Extensions;
@ -87,6 +88,8 @@ namespace GraphicsControls
set { SetValue(PlaceholderColorProperty, value); }
}
public event EventHandler Completed;
public override void Load()
{
base.Load();
@ -244,6 +247,8 @@ namespace GraphicsControls
void OnEditorUnfocused(object sender, FocusEventArgs e)
{
UpdateIsFocused(false);
Completed?.Invoke(this, EventArgs.Empty);
}
void FocusInternalEditorIfNeeded()

Просмотреть файл

@ -0,0 +1,97 @@
using System;
using System.Windows.Input;
using Xamarin.Forms;
namespace GraphicsControls
{
public interface IButton
{
ICommand Command { get; }
object CommandParameter { get; }
bool IsPressed { get; }
void PropagateUpClicked();
void PropagateUpPressed();
void PropagateUpReleased();
void SetIsPressed(bool isPressed);
void OnCommandCanExecuteChanged(object sender, EventArgs e);
bool IsEnabledCore { set; }
}
public static class ButtonElement
{
public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(IButton.Command), typeof(ICommand), typeof(IButton), null, propertyChanging: OnCommandChanging, propertyChanged: OnCommandChanged);
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create(nameof(IButton.CommandParameter), typeof(object), typeof(IButton), null,
propertyChanged: (bindable, oldvalue, newvalue) => CommandCanExecuteChanged(bindable, EventArgs.Empty));
static void OnCommandChanged(BindableObject bo, object o, object n)
{
IButton button = (IButton)bo;
if (n is ICommand newCommand)
newCommand.CanExecuteChanged += button.OnCommandCanExecuteChanged;
CommandChanged(button);
}
static void OnCommandChanging(BindableObject bo, object o, object n)
{
IButton button = (IButton)bo;
if (o != null)
{
(o as ICommand).CanExecuteChanged -= button.OnCommandCanExecuteChanged;
}
}
public const string PressedVisualState = "Pressed";
public static void CommandChanged(IButton sender)
{
if (sender.Command != null)
{
CommandCanExecuteChanged(sender, EventArgs.Empty);
}
else
{
sender.IsEnabledCore = true;
}
}
public static void CommandCanExecuteChanged(object sender, EventArgs e)
{
IButton ButtonElementManager = (IButton)sender;
ICommand cmd = ButtonElementManager.Command;
if (cmd != null)
{
ButtonElementManager.IsEnabledCore = cmd.CanExecute(ButtonElementManager.CommandParameter);
}
}
public static void ElementClicked(Xamarin.Forms.VisualElement visualElement, IButton ButtonElementManager)
{
if (visualElement.IsEnabled == true)
{
ButtonElementManager.Command?.Execute(ButtonElementManager.CommandParameter);
ButtonElementManager.PropagateUpClicked();
}
}
public static void ElementPressed(Xamarin.Forms.VisualElement visualElement, IButton ButtonElementManager)
{
if (visualElement.IsEnabled == true)
{
ButtonElementManager.SetIsPressed(true);
ButtonElementManager.PropagateUpPressed();
}
}
public static void ElementReleased(Xamarin.Forms.VisualElement visualElement, IButton ButtonElementManager)
{
if (visualElement.IsEnabled == true)
{
ButtonElementManager.SetIsPressed(false);
ButtonElementManager.PropagateUpReleased();
}
}
}
}

Просмотреть файл

@ -1,15 +1,19 @@
using System.Graphics;
using GColor = System.Graphics.Color;
using GraphicsControls.Extensions;
namespace GraphicsControls
{
public partial class Slider
{
const string DefaultCupertinoSliderTrackBackgroundColor = "#8E8E93";
const string DefaultCupertinoSliderTrackProgressColor = "#007AFF";
const string DefaultCupertinoSliderThumbColor = "#161313";
void DrawCupertinoSliderTrackBackground(ICanvas canvas, RectangleF dirtyRect)
{
canvas.SaveState();
canvas.FillColor = new GColor("#8E8E93");
canvas.FillColor = MaximumTrackColor.ToGraphicsColor(DefaultCupertinoSliderTrackBackgroundColor);
var x = dirtyRect.X;
@ -29,7 +33,7 @@ namespace GraphicsControls
{
canvas.SaveState();
canvas.FillColor = new GColor("#007AFF");
canvas.FillColor = MinimumTrackColor.ToGraphicsColor(DefaultCupertinoSliderTrackProgressColor);
var x = dirtyRect.X;
@ -52,7 +56,7 @@ namespace GraphicsControls
float size = 28f;
float strokeWidth = 0.5f;
canvas.StrokeColor = new GColor("#161313");
canvas.StrokeColor = ThumbColor.ToGraphicsColor(DefaultCupertinoSliderThumbColor);
canvas.StrokeSize = strokeWidth;
var value = ((double)Value).Clamp(0, 1);
@ -66,7 +70,7 @@ namespace GraphicsControls
var y = (float)((HeightRequest - size) / 2);
canvas.FillColor = Colors.White;
canvas.FillColor = ThumbColor.ToGraphicsColor(Colors.White.ToHex());
canvas.SetShadow(new SizeF(1, 1), 2, CanvasDefaults.DefaultShadowColor);

Просмотреть файл

@ -1,4 +1,5 @@
using System.Graphics;
using GraphicsControls.Extensions;
using Xamarin.Forms;
using GColor = System.Graphics.Color;
@ -25,7 +26,7 @@ namespace GraphicsControls
{
canvas.SaveState();
canvas.FillColor = new GColor(Fluent.Color.Primary.ThemeLight);
canvas.FillColor = MaximumTrackColor.ToGraphicsColor(Material.Color.LightBlue);
var x = dirtyRect.X;
@ -45,7 +46,7 @@ namespace GraphicsControls
{
canvas.SaveState();
canvas.FillColor = new GColor(Material.Color.Blue);
canvas.FillColor = MinimumTrackColor.ToGraphicsColor(Material.Color.Blue);
var x = dirtyRect.X;
@ -76,7 +77,7 @@ namespace GraphicsControls
var y = (float)((HeightRequest - MaterialFloatThumb) / 2);
canvas.FillColor = new GColor(Material.Color.Blue);
canvas.FillColor = ThumbColor.ToGraphicsColor(Material.Color.Blue);
canvas.FillOval(x, y, MaterialFloatThumb, MaterialFloatThumb);

Просмотреть файл

@ -28,7 +28,12 @@ namespace GraphicsControls
canvas.SaveState();
if (IsEnabled)
canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
{
if (IsToggled)
canvas.FillColor = OnColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
else
canvas.FillColor = BackgroundColor.ToGraphicsColor(Fluent.Color.Primary.ThemePrimary);
}
else
canvas.FillColor = ColorHelper.GetGraphicsColor(Fluent.Color.Background.NeutralLighter, Fluent.Color.Background.NeutralDark);

Просмотреть файл

@ -103,7 +103,8 @@
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('tizen')) ">
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="Tizen.NET" Version="4.0.0" />
<PackageReference Include="Tizen.NET" Version="4.0.0"><PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="JonLipsky.System.Graphics.Skia" Version="0.1.36" />
<Compile Include="**\*.tizen.cs" />
<Compile Include="**\*.tizen.*.cs" />