Files
maui-linux/Views/SkiaVisualState.cs

58 lines
1.6 KiB
C#
Raw Normal View History

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
namespace Microsoft.Maui.Platform;
2026-01-17 01:43:42 +00:00
/// <summary>
/// Represents a visual state with setters and optional triggers.
/// Maps to MAUI VisualState.
/// </summary>
public class SkiaVisualState
{
2026-01-17 01:43:42 +00:00
/// <summary>
/// Gets or sets the name of this visual state.
/// </summary>
public string Name { get; set; } = "";
2026-01-17 01:43:42 +00:00
/// <summary>
/// Gets the setters that define property changes for this state.
/// </summary>
public List<SkiaVisualStateSetter> Setters { get; } = new List<SkiaVisualStateSetter>();
2026-01-17 01:43:42 +00:00
/// <summary>
/// Gets the state triggers that can automatically activate this state.
/// </summary>
public List<SkiaStateTriggerBase> StateTriggers { get; } = new List<SkiaStateTriggerBase>();
/// <summary>
/// Gets or sets the target type this state applies to.
/// </summary>
public Type? TargetType { get; set; }
/// <summary>
/// Attaches triggers to the specified view.
/// </summary>
internal void AttachTriggers(SkiaView view)
{
foreach (var trigger in StateTriggers)
{
trigger.OwnerState = this;
trigger.OwnerView = view;
}
}
/// <summary>
/// Detaches triggers from the view.
/// </summary>
internal void DetachTriggers()
{
foreach (var trigger in StateTriggers)
{
trigger.OwnerState = null;
trigger.OwnerView = null;
}
}
}