committed by
GitHub
103 changed files with 1781 additions and 1945 deletions
@ -0,0 +1,26 @@ |
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// Defines the position of a color's alpha component relative to all other components.
|
|||
/// </summary>
|
|||
public enum AlphaComponentPosition |
|||
{ |
|||
/// <summary>
|
|||
/// The alpha component occurs before all other components.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// For example, this may indicate the #AARRGGBB or ARGB format which
|
|||
/// is the default format for XAML itself and the Color struct.
|
|||
/// </remarks>
|
|||
Leading, |
|||
|
|||
/// <summary>
|
|||
/// The alpha component occurs after all other components.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// For example, this may indicate the #RRGGBBAA or RGBA format which
|
|||
/// is the default format for CSS.
|
|||
/// </remarks>
|
|||
Trailing, |
|||
} |
|||
} |
|||
@ -1,24 +1,24 @@ |
|||
using System; |
|||
using System.ComponentModel; |
|||
using System.Globalization; |
|||
|
|||
using Avalonia.Media; |
|||
|
|||
|
|||
namespace Avalonia.Markup.Xaml.Converters |
|||
{ |
|||
public class FontFamilyTypeConverter : TypeConverter |
|||
{ |
|||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) |
|||
/// <inheritdoc />
|
|||
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) |
|||
{ |
|||
return sourceType == typeof(string); |
|||
} |
|||
|
|||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) |
|||
/// <inheritdoc />
|
|||
public override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) |
|||
{ |
|||
var s = (string)value; |
|||
|
|||
return FontFamily.Parse(s, context.GetContextBaseUri()); |
|||
return FontFamily.Parse(s, context?.GetContextBaseUri()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,33 +1,31 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using System.Text; |
|||
using Avalonia.Data.Core.Plugins; |
|||
using Avalonia.Reactive; |
|||
|
|||
namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings |
|||
{ |
|||
class ObservableStreamPlugin<T> : IStreamPlugin |
|||
internal class ObservableStreamPlugin<T> : IStreamPlugin |
|||
{ |
|||
[RequiresUnreferencedCode(TrimmingMessages.StreamPluginRequiresUnreferencedCodeMessage)] |
|||
public bool Match(WeakReference<object> reference) |
|||
public bool Match(WeakReference<object?> reference) |
|||
{ |
|||
return reference.TryGetTarget(out var target) && target is IObservable<T>; |
|||
} |
|||
|
|||
[RequiresUnreferencedCode(TrimmingMessages.StreamPluginRequiresUnreferencedCodeMessage)] |
|||
public IObservable<object> Start(WeakReference<object> reference) |
|||
public IObservable<object?> Start(WeakReference<object?> reference) |
|||
{ |
|||
if (!(reference.TryGetTarget(out var target) && target is IObservable<T> obs)) |
|||
{ |
|||
return Observable.Empty<object>(); |
|||
return Observable.Empty<object?>(); |
|||
} |
|||
else if (target is IObservable<object> obj) |
|||
else if (target is IObservable<object?> obj) |
|||
{ |
|||
return obj; |
|||
} |
|||
|
|||
return obs.Select(x => (object)x); |
|||
return obs.Select(x => (object?)x); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue