text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Avalonia.Data;
using Avalonia.Reactive;
namespace Avalonia
{
internal static class ClassBindingManager
{
private const string ClassPropertyPrefix = "__AvaloniaReserved::Classes::";
private... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Avalonia.Data.Core;
namespace Avalonia.Collections
{
/// <summary>
/// A notifying dictionar... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Reactive;
namespace Avalonia.Collections
{
/// <summary>
/// Defines extension methods for working with <see cref="AvaloniaList{T}"/>s.
/// </summary>
public stat... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using Avalonia.Diagnostics;
namespace Avalonia.Collections
{
/// <summary>
/// Describes the action notified on a clear of a <see cref="AvaloniaList{T}"/>.
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Avalonia.Utilities;
namespace Avalonia.Collections
{
/// <summary>
/// Creates an <see cref="AvaloniaList{T}"/> from a string representation.
/// </summary>
[RequiresUnrefer... | fim | AvaloniaUI/Avalonia | csharp |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using Avalonia.Reactive;
namespace Avalonia.Collections
{
/// <summary>
/// Defines extension methods for working with <see cref="AvaloniaList{T}"/>s.
/// </summary>
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ionary
where TKey : notnull
{
}
}
<|fim_prefix|>using System.Collections;
using System.Collections.Generic;
namespace Avalonia.Collections
{
public interface IAvaloniaDictionary<TKey, TValue>
<|fim_middle|>: IDictionary<TKey, TValue>,
IAvaloniaReadOnlyDictionary<TKey,... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System.Collections.Generic;
namespace Avalonia.Collections
{
/// <summary>
/// A notifying list.
/// </summary>
/// <typeparam name="T">The type of the items in the list.</typeparam>
public interface IAvaloniaList<T> : IList<T>, IAvaloniaReadOnlyList<T>
{
/// <summar... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>nam<|fim_suffix|>date(T item);
}
<|fim_middle|>espace Avalonia.Collections;
internal interface IAvaloniaListItemValidator<T>
{
void Vali<|endoftext|> | fim | AvaloniaUI/Avalonia | csharp |
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
namespace Avalonia.Collections
{
public interface IAvaloniaReadOnlyDictionary<TKey, TValue>
: IReadOnlyDictionary<TKey, TValue>,
INotifyCollectionChanged,
INotifyPropertyChanged
whe... | fim | AvaloniaUI/Avalonia | csharp |
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
namespace Avalonia.Collections
{
/// <summary>
/// A read-only notifying list.
/// </summary>
/// <typeparam name="T">The type of the items in the list.</typeparam>
public interface IA... | fim | AvaloniaUI/Avalonia | csharp |
using System;
using System.Collections.Specialized;
using Avalonia.Reactive;
using Avalonia.Utilities;
namespace Avalonia.Collections
{
public static class NotifyCollectionChangedExtensions
{
/// <summary>
/// Gets a weak observable for the CollectionChanged event.
/// </summary>
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>s setting could cause memory issues by making the garbage collector unable to clean up instances
/// that are still being referenced by arrays sitting in the ArrayPool.</para>
/// </summary>
Never = 2
}
}
<|fim_prefix|>// This source file is adapted from the Collections.Pooled... | fim | AvaloniaUI/Avalonia | csharp |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Avalonia.Collections.Pooled
{
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> /// Gets a <see cref="System.ReadOnlySpan{T}"/> for the items currently in the collection.
/// </summary>
#pragma warning restore CS0419
ReadOnlySpan<T> Span { get; }
}
}
<|fim_prefix|>// This source file is adapted from the Collections.Pooled.
// (https://github.com/jtmueller/Co... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>>(Func<T, TOutput> converter)
{
if (converter == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter);
}
var list = new PooledList<TOutput>(_size);
for (int i = 0; i < _size; i++)
{
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================================
**
**
** Purpose: An ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
n<|fim_suffix|>sableState.RootHidden)]
public T[] It... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// This file defines an internal class used to throw exceptions in BCL code.
// The main purpose is ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> Geometry2 = geometry2;
}
/// <summary>
/// Initializes a new instance of the <see cref="CombinedGeometry"/> class with the
/// specified <see cref="Geometry"/> objects and <see cref="GeometryCombineMode"/>.
/// </summary>
/// <param name="combine... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>lue = returnValue;
/// <summary>Gets the return value condition.</summary>
public bool ReturnValue { get; }
}
/// <summary>Specifies that the output will be non-null if the named parameter is non-null.</summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Pr... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>#if NETSTANDARD2_0
using System.Runtime.CompilerServices;
namespace<|fim_suffix|>blic static ReferenceEqualityComparer Instance { get; } = new();
private ReferenceEqualityComparer()
{
}
public new bool Equals(object? x, object? y)
=> ReferenceEquals(x, y);
public int GetH... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>#nullable enable
#pragma warning disable MA0048 // File name must match type name
// https://github.com/dotnet/runtime/tree/main/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this... | fim | AvaloniaUI/Avalonia | csharp |
using System.Threading.Tasks;
using Avalonia.Utilities;
namespace Avalonia.Controls
{
internal class ChildNameScope : INameScope
{
private readonly INameScope _parentScope;
private readonly NameScope _inner = new NameScope();
public ChildNameScope(INameScope parentScope)
{
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using Avalonia.Collections;
using Avalonia.Utilities;
namespace Avalonia.Controls
{
/// <summary>
/// Holds a collection of style classes for an <see cref="StyledElement"/>.
/// </summary>
/// <remarks>
/// Similar to CSS, each control m... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>="Classes"/> in a more
/// performant manner than subscribing to CollectionChanged.
/// </summary>
internal interface IClassesChangedListener
{
/// <summary>
/// Notifies the listener that the <see cref="Classes"/> collection has changed.
/// </summary>
void... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using Sys<|fim_suffix|>/// </summary>
public interface IDeferredContent
{
/// <summary>
/// Builds the deferred content using the specified service provider.
/// </summary>
/// <param name="serviceProvider">The service provider to use.</param>
/// <returns>The built content.</returns>... | fim | AvaloniaUI/Avalonia | csharp |
using Avalonia.Metadata;
using Avalonia.Utilities;
namespace Avalonia.Controls
{
/// <summary>
/// Defines a name scope.
/// </summary>
[NotClientImplementable]
public interface INameScope
{
/// <summary>
/// Registers an element in the name scope.
/// </summary>
... | fim | AvaloniaUI/Avalonia | csharp |
using Avalonia.Metadata;
namespace Avalonia.Controls
{
/// <summary>
/// Exposes an interface for setting pseudoclasses on a <see cref="Classes"/> collection.
/// </summary>
[NotClientImplementable]
public interface IPseudoClasses
{
/// <summary>
/// Adds a pseudoclass to the co... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System.Collections.Generic;
using Avalonia.Styling;
<|fim_suffix|>MergedDictionaries { get; }
/// <summary>
/// Gets a collection of merged resource dictionaries that are specifically keyed and composed to address theme scenarios.
/// </summary>
IDictionary<ThemeVa... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using Avalonia.Metadata;
name<|fim_suffix|>ou should not need to call
/// this method yourself. It is called when the resources hosted by this element have
/// changed, and is usually called by a resource dictionary or style hosted by the element
/// in response to ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using Avalonia.Metadata;
using Avalonia.Styling;
namespace Avalonia.Controls
{
/// <summary>
/// Represents an object that can be queried for resources.
/// </summary>
/// <remarks>
/// The interface represents a common interface for both controls that host resources
/// (<see cr... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using Avalonia.Styling;
#nullable enable
namespace Avalonia.Controls
{
/// <summary>
/// Represents an object that can be queried for resources but does not appear in the logical tree.
/// </summary>
/// <remarks>
/// This interface is implemented by <see cref="Resourc... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using Avalonia.Metadata;
namespace Avalonia.Controls
{
/// <summary>
/// Defines an interface through which a <see cref="StyledElement"/>'s inheritance parent can be set.
/// </summary>
/// <remarks>
/// You should not usually need to use this interface - it is for advanced scenarios ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using Avalonia.LogicalTree;
using Avalonia.Met<|fim_suffix|>t.
/// </summary>
/// <remarks>
/// You should not usually need to use this interface - it is for advanced scenarios only.
/// </remarks>
[NotClientImplementable]
public interface ISetLogicalParent
{
/// <summa... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using Avalonia.Metadata;
using Avalonia.Styling;
namespace Avalonia.Controls;
/// <summary>
/// Resource provider with theme variant awareness.
/// Can be used with <see cref="IResourceDictionary.ThemeDictionaries"/>.
/// </summary>
/// <remarks>
/// This is a helper interface for the XAML compiler to ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> {
PseudoClasses = pseudoClasses;
}
/// <summary>
/// Gets the list of pseudoclass names.
/// </summary>
public IReadOnlyList<string> PseudoClasses { get; }
}
}
<|fim_prefix|>using System;
using System.Collections.Generic;
#nullable enable
names... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>// This source file is adapted from the Windows Presentation Foundation project.
// (https://github.com/dotnet/wpf/)
//
// Licensed to The Avalonia Project under MIT License, courtesy of The .NET Foundation.
using System;
namespace Avalonia.Controls.Metadata
{
/// <summary>
/// Defines a con... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>esultSource<object?>> _pendingSearches =
new Dictionary<string, SynchronousCompletionAsyncResultSource<object?>>();
/// <summary>
/// Gets the value of the attached <see cref="NameScopeProperty"/> on a styled element.
/// </summary>
/// <param name="sty... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.LogicalTree;
namespace Avalonia.Controls
{
/// <s<|fim_suffix|>
/// <returns>The named element or null if not found.</returns>
public static T? Find<T>(this INameScope nameScope, string name)
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> public static IObservable<object?> Track(INameScope scope, string name)
{
return new NeverEndingSynchronousCompletionAsyncResultObservable<object?>(scope.FindAsync(name));
}
// This class is implemented in such weird way because for some reason
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ting whether the content can be scrolled horizontally.
/// </summary>
bool CanHorizontallyScroll { get; }
/// <summary>
/// Gets a value indicating whether the content can be scrolled horizontally.
/// </summary>
bool CanVerticallyScroll { get; }
}
}
<|... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>PseudoClasses classes, string name, bool value)
{
_ = classes ?? throw new ArgumentNullException(nameof(classes));
if (value)
{
classes.Add(name);
}
else
{
classes.Remove(name);
}
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Collections;
using Avalonia.Controls.Templates;
using Avalonia.Styling;
namespace Avalonia.Controls
{
/// <summary>
/// An indexed dictionary of resources.
/// </summary>
public cl... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ption(nameof(key));
return control.TryFindResource(key, null, out value);
}
/// <summary>
/// Finds the specified resource by searching up the logical tree and then global styles.
/// </summary>
/// <param name="control">The control.</param>
//... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> }
}
void IResourceProvider.AddOwner(IResourceHost owner)
{
owner = owner ?? throw new ArgumentNullException(nameof(owner));
if (Owner != null)
{
throw new InvalidOperationException("The ResourceDictionary already has a parent.");
}
Owne... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System.Threading;
namespace Avalonia.Controls;
/// <summary>
/// Represents the event arguments of <see cref="IResourceHost.ResourcesChanged"/>.
/// The <<|fim_suffix|>/ <param name="SequenceNumber">The sequence number used to identify the changes.</param>
/// <remarks>
/// For performance reasons... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>t; }
}
}
<|fim_prefix|>namespace Avalonia.Controls.Templates
{
public interface ITemplateResult
{<|fim_middle|>
public object? Result { get; }
public INameScope NameScope { ge<|endoftext|> | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>namespace Avalonia.Controls.Templates
{
public class TemplateResult<T> : ITemplateResult
{
public T Result { get; }
public INameScope NameScope { get; }
object? ITemplateResult.Result => Result;
public TemplateResult(T result, INameS<|fim_suffix|> NameScop... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>n indicating whether the given Object is equal to this corner radius instance.
/// </summary>
/// <param name="obj">The Object to compare against.</param>
/// <returns>True if the Object is equal to this corner radius; False otherwise.</returns>
public override bool Equals(... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
namespace Avalonia.Data
{
/// <summary>
/// Signifies that a binding can be assigned to a property.
/// </summary>
/// <remarks>
/// Usually in marku<|fim_suffix|>roperty rather than bound.
/// </remarks>
[AttributeUsage(AttributeTargets.Property | AttributeTarge... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>namespace Avalonia.Data;
/// <summary>
/// Base class for the various types of binding supported by Avalonia.
/// </summary>
public abstract class BindingBa<|fim_suffix|>ich returns a binding expression that is not yet connected to
/// a binding sink, and so is inactive.
/// </remarks>
intern... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
namespace Avalonia.Data
{
/// <summary>
/// An exception returned through <see cref="BindingNotification"/> signaling that a
/// requested binding expression could not be evaluated because of an error in one of
/// the links of the binding chain.
/// </summary>
publ... | fim | AvaloniaUI/Avalonia | csharp |
using System;
using Avalonia.PropertyStore;
using Avalonia.Styling;
namespace Avalonia.Data;
public abstract class BindingExpressionBase : IDisposable, ISetterInstance
{
private protected BindingExpressionBase()
{
}
public virtual void Dispose()
{
GC.SuppressFinalize(this);
}
//... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> target to source.
/// </summary>
OneWayToSource,
}
}
<|fim_prefix|>namespace Avalonia.Data
{
/// <summary>
/// Defines possible binding modes.
/// </summary>
public enum BindingMode
{
/// <summary>
/// Uses the default binding mode specified for the... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>row new ArgumentNullException(nameof(e));
if (type == BindingErrorType.None)
throw new ArgumentException("BindingErrorType may not be None", nameof(type));
Error = Error != null ? new AggregateException(Error, e) : e;
if (type == BindingErrorType.Erro... | fim | AvaloniaUI/Avalonia | csharp |
using System;
namespace Avalonia.Data
{
public static class BindingOperations
{
public static readonly object DoNothing = new DoNothingType();
/// <summary>
/// Retrieves the <see cref="BindingExpressionBase"/> that is currently active on the
/// specified property.
///... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.ComponentModel;
namespace Avalonia.Data
{
/// <summary>
/// The priority of a value or binding.
/// </summary>
public enum BindingPriority
{
/// <summary>
/// A value that comes from an animation.
/// </summary>
Animation = -1... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Avalonia.Utilities;
namespace Avalonia.Data
{
/// <summary>
/// Describes the type of a <see cref="BindingValue{T}"/>.
/// </summary>
[Flags]
public enum BindingValu... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> {
var enableDataValidation = targetProperty?.GetMetadata(target).EnableDataValidation ?? false;
var nodes = new List<ExpressionNode>();
var isRooted = false;
Path?.BuildExpression(nodes, out isRooted);
// If the binding isn't rooted (i.e. doesn't have a Source o... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>nal class ElementNameElement : ICompiledBindingPathElement, IControlSourceBindingPathElement
{
public ElementNameElement(INameScope nameScope, string name)
{
NameScope = nameScope;
Name = name;
}
public INameScope NameScope { get; }
publ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> val)
{
return !val;
}
return AvaloniaProperty.UnsetValue;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool val)
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>
if (TypeUtilities.IsNumeric(targetType))
{
message = $"'{value}' is not a valid number.";
}
else
{
message = $"Could not convert '{value}' to '{targetType.Name}'.";
}
return new BindingNo... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ry>
/// Initializes a new instance of the <see cref="FuncMultiValueConverter{TIn, TOut}"/> class.
/// </summary>
/// <param name="convert">The convert function.</param>
public FuncMultiValueConverter(Func<IEnumerable<TIn?>, TOut> convert)
: this(new Func<IReadOn... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>TIn?, TParam?, TOut> convert, Func<TOut?, TParam?, TIn>? convertBack = null)
{
_convert = convert;
_convertBack = convertBack;
}
/// <inheritdoc/>
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture);
}
}
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Globalization;
namespace Avalonia.Data.Converters
{
/// <summary>
/// Converts multi-binding inputs to a final value.
/// </s... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Globalizatio<|fim_suffix|> name="culture">The culture to use.</param>
/// <returns>The converted value.</returns>
/// <remarks>
/// This method should not throw exceptions. If the value is not convertible, return
/// a <see cref="BindingNotificati... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
<|fim_suffix|> var parameters = action.Method.GetParameters();
var parameterInfo = parameters.Length == 0 ? null : parameters[0].ParameterType;
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>verter IsNotNull =
new FuncValueConverter<object?, bool>(x => x is not null);
/// <summary>
/// A value converter that returns true if the input object is equal to a parameter object.
/// </summary>
public static readonly IValueConverter Equal =
new... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>namespace Avalonia.Data.Converters
{
/// <summary>
/// Provides a set of useful <see cref="IValueConverter"/>s for working with string val<|fim_suffix|>tring?, bool>(string.IsNullOrEmpty);
/// <summary>
/// A value converter that returns true if the input string is not null or emp... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Avalonia.Data.Converters
{
/// <summary>
/// A multi-value converter which calls <see cref="string.Format(string, object)"/>
/// </summary>
public class StringFormatMultiValueConverte... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>parameter, CultureInfo culture)
{
value = Inner?.Convert(value, targetType, parameter, culture) ?? value;
var format = Format!;
if (!format.Contains('{'))
{
format = $"{{0:{format}}}";
}
return string.Format(cu... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>pe ErrorType { get; }
}
<|fim_prefix|>using System;
using System.Diagnostics;
namespace Avalonia.Data.Core;
internal class BindingError
{
public BindingError(Exception exception, BindingErrorType errorType)
{
Debug.Assert(errorType != Bin<|fim_middle|>dingErrorType.None);
Excep... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>);
if (ShouldLogError(out var target))
Log(target, error, errorPoint);
// Clear the current value and publish the error.
var bindingError = new BindingError(
new BindingChainException(error, Description, errorPoint.ToString()),
BindingErrorType... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Reflection;
namespa<|fim_suffix|>lrPropertyInfo : ClrPropertyInfo
{
private static Action<object, object?>? CreateSetter(PropertyInfo info)
=> info.SetMethod is { } setMethod ?
(target, value) => setMethod.Invoke(target, [value]) :
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>namespace Avalonia.Data.Core
{
internal static class CommonPrope<|fim_suffix|> public const string IndexerName = "Item";
}
}
<|fim_middle|>rtyNames
{
<|endoftext|> | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>der.Append(_indexes[i]);
if (i != _indexes.Length - 1)
builder.Append(',');
}
builder.Append(']');
}
public bool WriteValueToSource(object? value, IReadOnlyList<ExpressionNode> nodes)
{
if (Source is Array array)
{
array... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Text;
using Avalonia.Utilities;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class AvaloniaPropertyAccessorNode :
ExpressionNode,
ISettableNode,
IWeakEventSubscriber<AvaloniaPropertyChangedEventArgs>
{
public A... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
<|fim_suffix|>space Avalonia.Data.Core.ExpressionNodes;
internal abstract class CollectionNodeBase : ExpressionNode,
IWeakEventSubscriber<NotifyCollectionChangedEventArgs>,
IWeakEventSubscr... | fim | AvaloniaUI/Avalonia | csharp |
using System;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class DataContextNode : DataContextNodeBase
{
protected override void OnSourceChanged(object? source, Exception? dataValidationError)
{
if (!ValidateNonNullSource(source))
return;
if (source is IDataConte... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>perty.UnsetValue)
throw new NotSupportedException(
"DataContextNode is invalid in conjunction with a binding source.");
if (target is IDataContextProvider and AvaloniaObject)
return target;
if (anchor is IDataContextProvider and AvaloniaObject)
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Text;
namespace Avalonia.Data.Core.ExpressionNodes;
/// <summary>
/// A node in the binding path of an <see cref="BindingExpression"/>.
/// </summary>
in... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
namespace Avalonia.Data.Core.ExpressionNodes;
/// <summary>
/// A node in an <see cref="BindingExpression"/> which uses a function to transform its
/// value.
/// </summary>
internal sealed class FuncTransf<|fim_suffix|>builder)
{
// We don't have enough inf... | fim | AvaloniaUI/Avalonia | csharp |
using Avalonia.Data.Core.Plugins;
namespace Avalonia.Data.Core.ExpressionNodes;
/// <summary>
/// Indicates that a <see cref="ExpressionNode"/> accesses a property on an object.
/// </summary>
internal interface IPropertyAccessorNode
{
string PropertyName { get; }
IPropertyAccessor? Accessor { get; }
voi... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>Node> nodes);
}
<|fim_prefix|>using System;
using System.Collections.Generic;
namespace Avalonia.Data.Core.ExpressionNodes;
/// <summary>
/// An <see cref="ExpressionNode"/> that can write a value to its source.
/// </summary>
internal interface ISettableNode
{
/// <summary>
/// Gets the type o... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>
if (_ancestorType is not null)
{
builder.Append(_ancestorType.Name);
if (_ancestorLevel > 0)
builder.Append(',');
}
if (_ancestorLevel > 0)
builder.Append(_ancestorLevel);
bu... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class LogicalNotNode : ExpressionNode, ISettableNode
{
public override void BuildString(StringBuilder builder)
{
builder.Append("!... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>Invoke(this, EventArgs.Empty)
, Threading.DispatcherPriority.Input);
}
public bool CanExecute(object? parameter)
{
if (_target.TryGetTarget(out var target))
{
if (_canExecute == null)
{
retu... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
using Avalonia.Controls;
using Avalonia.LogicalTree;
using Avalonia.Reactive;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class NamedElementNode : SourceNode
{
private readonly WeakReference<INameScope?> _nameScope;
private readonly string _nam... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>ide void Unsubscribe(object oldSource)
{
if (oldSource is AvaloniaObject oldElement)
oldElement.PropertyChanged -= OnPropertyChanged;
}
private void SetParent(AvaloniaObject? parent)
{
if (parent == _parent)
return;
Unsubscribe();
_... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Avalonia.Data.Core.Plugins;
namespace Avalonia.Data.Core.ExpressionNodes;
/// <summary>
/// A node in the binding path of an <see cref="BindingExpression"/> that reads a property
/// via a pre... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Avalonia.Data.Core.Plugins;
namespace Avalonia.Data.Core.ExpressionNodes.Reflection;
/// <summary>
/// A node in the binding path of an <see cref="BindingExpression"/> that reads a property
//... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Avalonia.Data.Core.Plugins;
using Avalonia.Reactive;
namespace Avalonia.Data.Core.ExpressionNodes.Reflection;
[RequiresUnreferencedCode(TrimmingMessages.Expressi<|fim_suffix|>
{
if (plugin.Match(source))
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|>
_expression = expression.Update(_parameter, expression.Arguments);
_getDelegate = Expression.Lambda(_expression, _parameter).Compile();
_setDelegate = Expression.Lambda(Expression.Assign(_expression, valueParameter), _parameter, valueParameter).Compile();
_firstArgumentDel... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using Avalonia.Input;
usi<|fim_suffix|>ype(), out _getter, out _setter))... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
namespace Avalonia.Data.Core.ExpressionNodes.Reflection;
/// <summary>
/// A node in an <see cref="BindingExpression"/> <|fim_suffix|>d OnSourceChanged(object? source, Exception? dataValidationError)
{
if (!ValidateNonNullSource(source))
return;
... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_suffix|> of the binding, e.g. DataContext,
/// logical ancestor.
/// </summary>
internal abstract class SourceNode : ExpressionNode
{
/// <summary>
/// Selects the source for the binding expression based on the binding source, target and
/// anchor.
/// </summary>
/// <param name="source">The ... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
using Avalonia.Data.Core.Plugins;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class StreamNode : ExpressionNode, IObserver<object?>
{
private IStreamPlugin _plugin;
private IDisposable? _subscription;
public StreamNode(IStreamPlugin plugin... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
namespace Avalonia.Data.Core.ExpressionNodes;
internal sealed class<|fim_suffix|>nt.TemplatedParent);
}
else
{
SetError($"Unable to read TemplatedParent from '{source.GetType()}'.");
}
}
protected override void Unsubs... | fim | AvaloniaUI/Avalonia | csharp |
<|fim_prefix|>using System;
using System.Text;
using Avalonia.Reactive;
using Avalonia.VisualTree;
<|fim_suffix|>Append("$visualParent");
if (_ancestorLevel > 0 || _ancestorType is not null)
{
builder.Append('[');
if (_ancestorType is not null)
{
bu... | fim | AvaloniaUI/Avalonia | csharp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.