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.
38 lines
1.3 KiB
38 lines
1.3 KiB
// Copyright (c) The Perspex Project. All rights reserved.
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Perspex.Interactivity
|
|
{
|
|
/// <summary>
|
|
/// Provides extension methods for the <see cref="IInteractive"/> interface.
|
|
/// </summary>
|
|
public static class InteractiveExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets the route for bubbling events from the specified interactive.
|
|
/// </summary>
|
|
/// <param name="interactive">The interactive.</param>
|
|
/// <returns>The event route.</returns>
|
|
public static IEnumerable<IInteractive> GetBubbleEventRoute(this IInteractive interactive)
|
|
{
|
|
while (interactive != null)
|
|
{
|
|
yield return interactive;
|
|
interactive = interactive.InteractiveParent;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the route for tunneling events from the specified interactive.
|
|
/// </summary>
|
|
/// <param name="interactive">The interactive.</param>
|
|
/// <returns>The event route.</returns>
|
|
public static IEnumerable<IInteractive> GetTunnelEventRoute(this IInteractive interactive)
|
|
{
|
|
return interactive.GetBubbleEventRoute().Reverse();
|
|
}
|
|
}
|
|
}
|
|
|