Skip to content

Commit

Permalink
Merge branch 'main' into net7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Oct 27, 2022
2 parents 95ee1a3 + 50d5bc9 commit ee9a2e1
Show file tree
Hide file tree
Showing 144 changed files with 669 additions and 617 deletions.
3 changes: 1 addition & 2 deletions src/Controls/src/Core/ActionSheetArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public ActionSheetArguments(string title, string cancel, string destruction, IEn
/// </summary>
public string Title { get; private set; }

/// <include file="../../docs/Microsoft.Maui.Controls.Internals/ActionSheetArguments.xml" path="//Member[@MemberName='FlowDirection']/Docs/*" />
public FlowDirection FlowDirection { get; set; }

/// <include file="../../docs/Microsoft.Maui.Controls.Internals/ActionSheetArguments.xml" path="//Member[@MemberName='SetResult']/Docs/*" />
Expand All @@ -53,4 +52,4 @@ public void SetResult(string result)
Result.TrySetResult(result);
}
}
}
}
3 changes: 1 addition & 2 deletions src/Controls/src/Core/AlertArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public AlertArguments(string title, string message, string accept, string cancel
/// <include file="../../docs/Microsoft.Maui.Controls.Internals/AlertArguments.xml" path="//Member[@MemberName='Result']/Docs/*" />
public TaskCompletionSource<bool> Result { get; }

/// <include file="../../docs/Microsoft.Maui.Controls.Internals/AlertArguments.xml" path="//Member[@MemberName='FlowDirection']/Docs/*" />
public FlowDirection FlowDirection { get; set; }

/// <summary>
Expand All @@ -50,4 +49,4 @@ public void SetResult(bool result)
Result.TrySetResult(result);
}
}
}
}
71 changes: 59 additions & 12 deletions src/Controls/src/Core/Animation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,45 @@
using System.Collections;
using System.Collections.Generic;
using BaseAnimation = Microsoft.Maui.Animations.Animation;

namespace Microsoft.Maui.Controls
{
/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="Type[@FullName='Microsoft.Maui.Controls.Animation']/Docs/*" />
/// <summary>
/// Encapsulates an animation, a collection of functions that modify properties over a user-perceptible time period.
/// </summary>
public class Animation : BaseAnimation
{
bool _finishedTriggered;

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='.ctor'][1]/Docs/*" />
/// <summary>
/// Creates a new <see cref="Animation" /> object with default values.
/// </summary>
public Animation()
{
Easing = Easing.Linear;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='.ctor']/Docs/*" />
/// <summary>
/// Creates a new <see cref = "Animation" /> object with the specified parameters.
/// </summary>
/// <param name="callback">An action that is called with successive animation values.</param>
/// <param name="start"> The fraction into the current animation at which to start the animation.</param>
/// <param name="end"> The fraction into the current animation at which to end the animation.</param>
/// <param name="easing"> The easing function to use to transition in, out, or in and out of the animation.</param>
/// <param name="finished"> An action to call when the animation is finished.</param>
public Animation(Action<double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, Action finished = null) : base(callback, start, end - start, easing, finished)
{

Easing = easing ?? Easing.Linear;
Func<double, double> transform = AnimationExtensions.Interpolate(start, end);
Step = f => callback(transform(f));
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='Add']/Docs/*" />
/// <summary>
/// Adds an <see cref="Animation"/> object to this <see cref="Animation"/> that begins at <paramref name="beginAt"/> and finishes at <paramref name="finishAt"/>.
/// </summary>
/// <param name="beginAt">The fraction into this animation at which the added child animation will begin animating.</param>
/// <param name="finishAt">The fraction into this animation at which the added child animation will stop animating.</param>
/// <param name="animation">The animation to add.</param>
public void Add(double beginAt, double finishAt, Animation animation)
{
if (beginAt < 0 || beginAt > 1)
Expand All @@ -41,13 +57,25 @@ public void Add(double beginAt, double finishAt, Animation animation)
childrenAnimations.Add(animation);
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='Commit']/Docs/*" />
/// <summary>
/// Runs the <paramref name="owner" /> animation with the supplied parameters.
/// </summary>
/// <param name="owner">The owning animation that will be animated.</param>
/// <param name="name">The name, or handle, that is used to access and track the animation and its state.</param>
/// <param name="rate">The time, in milliseconds, between frames.</param>
/// <param name="length">The number of milliseconds over which to interpolate the animation.</param>
/// <param name="easing">The easing function to use to transition in, out, or in and out of the animation.</param>
/// <param name="finished">An action to call when the animation is finished.</param>
/// <param name="repeat">A function that should return true if the animation should continue.</param>
public void Commit(IAnimatable owner, string name, uint rate = 16, uint length = 250, Easing easing = null, Action<double, bool> finished = null, Func<bool> repeat = null)
{
owner.Animate(name, this, rate, length, easing, finished, repeat);
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='GetCallback']/Docs/*" />
/// <summary>
/// Returns a callback that recursively runs the eased animation step on this <see cref="Animation" /> object and those of its children that have begun and not finished.
/// </summary>
/// <returns>A callback that recursively runs the eased animation step on this <see cref="Animation" /> object and those of its children that have begun and not finished.</returns>
public Action<double> GetCallback()
{
Action<double> result = f =>
Expand Down Expand Up @@ -78,21 +106,30 @@ public Action<double> GetCallback()

internal void ResetChildren() => this.Reset();

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='Reset']/Docs/*" />
public override void Reset()
{
base.Reset();
_finishedTriggered = false;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='Insert']/Docs/*" />
/// <summary>
/// Adds an <see cref="Animation" /> object to this <see cref="Animation" /> that begins at <paramref name="beginAt" /> and finishes at <paramref name="finishAt" />.
/// </summary>
/// <param name="beginAt">The fraction into this animation at which the added child animation will begin animating.</param>
/// <param name="finishAt">The fraction into this animation at which the added child animation will stop animating.</param>
/// <param name="animation">The animation to add.</param>
public Animation Insert(double beginAt, double finishAt, Animation animation)
{
Add(beginAt, finishAt, animation);
return this;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='WithConcurrent'][1]/Docs/*" />
/// <summary>
/// Adds <paramref name="animation" /> to the children of this <see cref="Animation" /> object and sets the start and end times of <paramref name="animation" /> to <paramref name="beginAt" /> and <paramref name="finishAt" />, respectively.
/// </summary>
/// <param name="animation">The animation to add.</param>
/// <param name="beginAt">The fraction into this animation at which the added child animation will begin animating.</param>
/// <param name="finishAt">The fraction into this animation at which the added child animation will stop animating.</param>
public Animation WithConcurrent(Animation animation, double beginAt = 0.0f, double finishAt = 1.0f)
{
animation.StartDelay = beginAt;
Expand All @@ -101,7 +138,15 @@ public Animation WithConcurrent(Animation animation, double beginAt = 0.0f, doub
return this;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='WithConcurrent'][2]/Docs/*" />
/// <summary>
/// Creates a new <see cref="Animation" /> object with the specified <paramref name="callback" />, and adds it to the children of this <see cref="Animation" /> object.
/// </summary>
/// <param name="callback">An action that is called with successive animation values.</param>
/// <param name="start">The fraction into the current animation at which to start the animation.</param>
/// <param name="end">The fraction into the current animation at which to end the animation.</param>
/// <param name="easing">The easing function to use to transition in, out, or in and out of the animation.</param>
/// <param name="beginAt">The fraction into this animation at which the added child animation will begin animating.</param>
/// <param name="finishAt">The fraction into this animation at which the added child animation will stop animating.</param>
public Animation WithConcurrent(Action<double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, double beginAt = 0.0f, double finishAt = 1.0f)
{
var child = new Animation(callback, start, end, easing);
Expand All @@ -111,7 +156,9 @@ public Animation WithConcurrent(Action<double> callback, double start = 0.0f, do
return this;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Animation.xml" path="//Member[@MemberName='IsEnabled']/Docs/*" />
/// <summary>
/// Specifies if this animation is currently enabled.
/// </summary>
public bool IsEnabled
{
get
Expand Down
3 changes: 0 additions & 3 deletions src/Controls/src/Core/AnimationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ static AnimationExtensions()
s_tweeners = new Dictionary<int, Animation>();
}

/// <include file="../../docs/Microsoft.Maui.Controls/AnimationExtensions.xml" path="//Member[@MemberName='Add']/Docs/*" />
public static int Add(this IAnimationManager animationManager, Action<double> step)
{
var id = s_currentTweener++;
Expand All @@ -61,7 +60,6 @@ public static int Add(this IAnimationManager animationManager, Action<double> st
animation.Commit(animationManager);
return id;
}
/// <include file="../../docs/Microsoft.Maui.Controls/AnimationExtensions.xml" path="//Member[@MemberName='Insert']/Docs/*" />
public static int Insert(this IAnimationManager animationManager, Func<long, bool> step)
{
var id = s_currentTweener++;
Expand All @@ -75,7 +73,6 @@ public static int Insert(this IAnimationManager animationManager, Func<long, boo
animation.Commit(animationManager);
return id;
}
/// <include file="../../docs/Microsoft.Maui.Controls/AnimationExtensions.xml" path="//Member[@MemberName='Remove']/Docs/*" />
public static void Remove(this IAnimationManager animationManager, int tickerId)
{
var animation = s_tweeners[tickerId];
Expand Down
3 changes: 1 addition & 2 deletions src/Controls/src/Core/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ public AppTheme UserAppTheme
public AppTheme RequestedTheme => UserAppTheme != AppTheme.Unspecified ? UserAppTheme : PlatformAppTheme;

static Color? _accentColor;
/// <include file="../../docs/Microsoft.Maui.Controls/Application.xml" path="//Member[@MemberName='AccentColor']/Docs/*" />
public static Color? AccentColor
{
get => _accentColor ??= GetAccentColor();
Expand Down Expand Up @@ -385,4 +384,4 @@ protected internal virtual void CleanUp()

IReadOnlyList<Maui.IVisualTreeElement> IVisualTreeElement.GetVisualChildren() => this.Windows;
}
}
}
3 changes: 0 additions & 3 deletions src/Controls/src/Core/AutomationProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class AutomationProperties
/// <include file="../../docs/Microsoft.Maui.Controls/AutomationProperties.xml" path="//Member[@MemberName='IsInAccessibleTreeProperty']/Docs/*" />
public static readonly BindableProperty IsInAccessibleTreeProperty = BindableProperty.Create("IsInAccessibleTree", typeof(bool?), typeof(AutomationProperties), null);

/// <include file="../../docs/Microsoft.Maui.Controls/AutomationProperties.xml" path="//Member[@MemberName='ExcludedWithChildrenProperty']/Docs/*" />
public static readonly BindableProperty ExcludedWithChildrenProperty = BindableProperty.Create("ExcludedWithChildren", typeof(bool?), typeof(AutomationProperties), null);

/// <include file="../../docs/Microsoft.Maui.Controls/AutomationProperties.xml" path="//Member[@MemberName='LabeledByProperty']/Docs/*" />
Expand All @@ -30,7 +29,6 @@ public static string GetHelpText(BindableObject bindable)
return (bool?)bindable.GetValue(IsInAccessibleTreeProperty);
}

/// <include file="../../docs/Microsoft.Maui.Controls/AutomationProperties.xml" path="//Member[@MemberName='GetExcludedWithChildren']/Docs/*" />
public static bool? GetExcludedWithChildren(BindableObject bindable)
{
return (bool?)bindable.GetValue(ExcludedWithChildrenProperty);
Expand Down Expand Up @@ -61,7 +59,6 @@ public static void SetIsInAccessibleTree(BindableObject bindable, bool? value)
bindable.SetValue(IsInAccessibleTreeProperty, value);
}

/// <include file="../../docs/Microsoft.Maui.Controls/AutomationProperties.xml" path="//Member[@MemberName='SetExcludedWithChildren']/Docs/*" />
public static void SetExcludedWithChildren(BindableObject bindable, bool? value)
{
bindable.SetValue(ExcludedWithChildrenProperty, value);
Expand Down
2 changes: 0 additions & 2 deletions src/Controls/src/Core/BindableObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public static void SetBinding(this BindableObject self, BindableProperty targetP
self.SetBinding(targetProperty, binding);
}

/// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='GetPropertyIfSet']/Docs/*" />
public static T GetPropertyIfSet<T>(this BindableObject bindableObject, BindableProperty bindableProperty, T returnIfNotSet)
{
if (bindableObject == null)
Expand All @@ -54,7 +53,6 @@ public static T GetPropertyIfSet<T>(this BindableObject bindableObject, Bindable
return returnIfNotSet;
}

/// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='SetAppTheme']/Docs/*" />
public static void SetAppTheme<T>(this BindableObject self, BindableProperty targetProperty, T light, T dark) => self.SetBinding(targetProperty, new AppThemeBinding { Light = light, Dark = dark });

/// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='SetAppThemeColor']/Docs/*" />
Expand Down
6 changes: 1 addition & 5 deletions src/Controls/src/Core/BindablePropertyConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ namespace Microsoft.Maui.Controls
[Xaml.ProvideCompiled("Microsoft.Maui.Controls.XamlC.BindablePropertyConverter")]
public sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
{
/// <include file="../../docs/Microsoft.Maui.Controls/BindablePropertyConverter.xml" path="//Member[@MemberName='CanConvertFrom']/Docs/*" />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/BindablePropertyConverter.xml" path="//Member[@MemberName='CanConvertTo']/Docs/*" />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
=> true;

Expand Down Expand Up @@ -74,7 +72,6 @@ object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceP
throw new XamlParseException($"Can't resolve {value}. Syntax is [[prefix:]Type.]PropertyName.", lineinfo);
}

/// <include file="../../docs/Microsoft.Maui.Controls/BindablePropertyConverter.xml" path="//Member[@MemberName='ConvertFrom']/Docs/*" />
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
var strValue = value?.ToString();
Expand Down Expand Up @@ -144,12 +141,11 @@ Type FindTypeForVisualState(IProvideParentValues parentValueProvider, IXmlLineIn

}

/// <include file="../../docs/Microsoft.Maui.Controls/BindablePropertyConverter.xml" path="//Member[@MemberName='ConvertTo']/Docs/*" />
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (value is not BindableProperty bp)
throw new NotSupportedException();
return $"{bp.DeclaringType.Name}.{bp.PropertyName}";
}
}
}
}
1 change: 0 additions & 1 deletion src/Controls/src/Core/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Microsoft.Maui.Controls
/// <include file="../../docs/Microsoft.Maui.Controls/Binding.xml" path="Type[@FullName='Microsoft.Maui.Controls.Binding']/Docs/*" />
public sealed class Binding : BindingBase
{
/// <include file="../../docs/Microsoft.Maui.Controls/Binding.xml" path="//Member[@MemberName='SelfPath']/Docs/*" />
public const string SelfPath = ".";
IValueConverter _converter;
object _converterParameter;
Expand Down
8 changes: 2 additions & 6 deletions src/Controls/src/Core/BrushTypeConverter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
Expand Down Expand Up @@ -28,15 +28,12 @@ public class BrushTypeConverter : TypeConverter

readonly ColorTypeConverter _colorTypeConverter = new ColorTypeConverter();

/// <include file="../../docs/Microsoft.Maui.Controls/BrushTypeConverter.xml" path="//Member[@MemberName='CanConvertFrom']/Docs/*" />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/BrushTypeConverter.xml" path="//Member[@MemberName='CanConvertTo']/Docs/*" />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
=> false;

/// <include file="../../docs/Microsoft.Maui.Controls/BrushTypeConverter.xml" path="//Member[@MemberName='ConvertFrom']/Docs/*" />
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
var strValue = value?.ToString();
Expand Down Expand Up @@ -73,7 +70,6 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
}


/// <include file="../../docs/Microsoft.Maui.Controls/BrushTypeConverter.xml" path="//Member[@MemberName='ConvertTo']/Docs/*" />
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
=> throw new NotSupportedException();

Expand Down Expand Up @@ -411,4 +407,4 @@ bool TryParseOffsets(string[] parts, out float[] result)
}
}
}
}
}
Loading

0 comments on commit ee9a2e1

Please sign in to comment.