csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
using Avalonia.Controls;
|
|
using Avalonia.Data;
|
|
using Avalonia.LogicalTree;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
|
|
namespace Avalonia.Markup.Xaml.UnitTests.Xaml
|
|
{
|
|
public class InitializationOrderTracker : Control, ISupportInitialize
|
|
{
|
|
public IList<string> Order { get; } = new List<string>();
|
|
|
|
public int InitState { get; private set; }
|
|
|
|
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
|
{
|
|
Order.Add("AttachedToLogicalTree");
|
|
base.OnAttachedToLogicalTree(e);
|
|
}
|
|
|
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
|
{
|
|
Order.Add($"Property {change.Property.Name} Changed");
|
|
base.OnPropertyChanged(change);
|
|
}
|
|
|
|
void ISupportInitialize.BeginInit()
|
|
{
|
|
++InitState;
|
|
base.BeginInit();
|
|
Order.Add($"BeginInit {InitState}");
|
|
}
|
|
|
|
void ISupportInitialize.EndInit()
|
|
{
|
|
--InitState;
|
|
base.EndInit();
|
|
Order.Add($"EndInit {InitState}");
|
|
}
|
|
}
|
|
}
|
|
|