docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ZoomableThumbnail

    A thumbnail that can be opened full-size.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ZoomableThumbnail
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.densityOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.SetActivePseudoState(bool)
    VisualElement.SetCheckedPseudoState(bool)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.IsMarkedForRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.SetBinding(BindingId, Binding)
    VisualElement.GetBinding(BindingId)
    VisualElement.TryGetBinding(BindingId, out Binding)
    VisualElement.GetBindingInfos()
    VisualElement.GetBindingInfos(List<BindingInfo>)
    VisualElement.HasBinding(BindingId)
    VisualElement.ClearBinding(BindingId)
    VisualElement.ClearBindings()
    VisualElement.GetHierarchicalDataSourceContext()
    VisualElement.GetDataSourceContext(BindingId)
    VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
    VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
    VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.disablePlayModeTint
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.scaledPixelsPerPoint
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.hasActivePseudoState
    VisualElement.hasInactivePseudoState
    VisualElement.hasHoverPseudoState
    VisualElement.hasCheckedPseudoState
    VisualElement.hasEnabledPseudoState
    VisualElement.hasDisabledPseudoState
    VisualElement.hasFocusPseudoState
    VisualElement.hasRootPseudoState
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.languageDirection
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.dataSource
    VisualElement.dataSourcePath
    VisualElement.dataSourceType
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.contentContainer
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.resolvedStyle
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, CallbackOptions)
    CallbackEventHandler.UnregisterAllRemovableCallbacks()
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    CallbackEventHandler.HandleEventBubbleUp(EventBase)
    CallbackEventHandler.HandleEventTrickleDown(EventBase)
    CallbackEventHandler.ExecuteDefaultAction(EventBase)
    CallbackEventHandler.NotifyPropertyChanged(in BindingId)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    [UxmlElement]
    public class ZoomableThumbnail : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
    Remarks

    The thumbnail owns its own ImageLightbox and builds a Modal for it only when the user asks, so a grid of these costs no more than the images themselves. The modal is dismissed by a click outside the viewer, by Esc, or by CloseZoom().

    triggerMode chooses the affordance. Corner puts a ZoomTriggerButton in the top corner, hidden until the thumbnail is hovered or the control itself takes focus. Whole stretches that same control over the whole image and paints a scrim behind its glyph on hover, which is what tells the user the picture is a button. USS has no :focus-within, so the reveal is keyed off the control's own :focus plus a class this element raises while hovered.

    Set trigger to false to render just the image, with no control and no viewer, for a caller whose thumbnail sits inside another interactive element such as a list item or a button. A nested control there is unreachable, so such a caller hosts the control and the viewer itself, as a sibling of that element.

    A larger image can be supplied up front through fullSrc, or resolved lazily through loadFullSrc, which is called at most once and never on mount, so a grid of these issues no requests until someone actually zooms.

    Not ported from the registry. The web version keeps its dialog mounted at all times, because unmounting it in the same commit that closes it skips the library's close path and can leave the document hit-test-dead. UI Toolkit's Modal owns no such global state and is dismissed explicitly, so the viewer is built on demand here and the guard would be dead code.

    Examples

    A grid tile with a corner control and a lazily resolved full-size image.

    var thumb = new ZoomableThumbnail
    {
        src = BackgroundExtensions.FromObject(previewTexture),
        alt = "Cliff face, tiling",
        caption = "cliff-face-01.png",
        fallback = new Icon { iconName = "image" },
    };
    thumb.loadFullSrc = resolved => StartCoroutine(FetchFullRes(url, resolved));

    UXML declaration — the whole picture is the control.

    <appui:ZoomableThumbnail caption="cliff-face-01.png" alt="Cliff face" trigger-mode="Whole" />

    Constructors

    ZoomableThumbnail()

    Default constructor.

    Declaration
    public ZoomableThumbnail()

    Fields

    fallbackUssClassName

    The styling class of the container holding the fallback content.

    Declaration
    public const string fallbackUssClassName = "appui-zoomablethumbnail__fallback"
    Field Value
    Type Description
    string

    imageUssClassName

    The styling class of the element the thumbnail is painted on.

    Declaration
    public const string imageUssClassName = "appui-zoomablethumbnail__image"
    Field Value
    Type Description
    string

    triggerModeUssClassName

    The ZoomableThumbnail trigger-mode styling class.

    Declaration
    public const string triggerModeUssClassName = "appui-zoomablethumbnail--"
    Field Value
    Type Description
    string

    triggerUssClassName

    The styling class of the zoom control, whichever mode it is in.

    Declaration
    public const string triggerUssClassName = "appui-zoomablethumbnail__trigger"
    Field Value
    Type Description
    string

    ussClassName

    The ZoomableThumbnail main styling class.

    Declaration
    public const string ussClassName = "appui-zoomablethumbnail"
    Field Value
    Type Description
    string

    Properties

    alt

    A textual description of the enlarged image. The thumbnail itself is decorative.

    Declaration
    [CreateProperty]
    [UxmlAttribute("alt")]
    [Header("Zoomable Thumbnail")]
    public string alt { get; set; }
    Property Value
    Type Description
    string

    caption

    Names the asset, in the zoom control's label and under the enlarged image.

    Declaration
    [CreateProperty]
    [UxmlAttribute("caption")]
    public string caption { get; set; }
    Property Value
    Type Description
    string

    fallback

    Shown when there is no image, or it fails to resolve. Also handed to the viewer, so an enlarged image that never arrives shows the same thing.

    Declaration
    public VisualElement fallback { get; set; }
    Property Value
    Type Description
    VisualElement

    fullSrc

    A larger image already known to the caller. Preferred over src when zoomed.

    Declaration
    [CreateProperty]
    public Background fullSrc { get; set; }
    Property Value
    Type Description
    Background

    hasImage

    Whether the thumbnail has an image to paint.

    Declaration
    public bool hasImage { get; }
    Property Value
    Type Description
    bool

    lightbox

    The viewer this thumbnail opens. Exposed so a caller can style it or read what it is showing.

    Declaration
    public ImageLightbox lightbox { get; }
    Property Value
    Type Description
    ImageLightbox

    loadFullSrc

    Resolves a larger image lazily. Called at most once, on first open — never on mount.

    Declaration
    public FullImageResolver loadFullSrc { get; set; }
    Property Value
    Type Description
    FullImageResolver

    src

    The small image. Unset means there is nothing to show or zoom, and the fallback stands in.

    Declaration
    [CreateProperty]
    public Background src { get; set; }
    Property Value
    Type Description
    Background

    trigger

    Whether the thumbnail offers the zoom control and the viewer at all.

    Declaration
    [CreateProperty]
    [UxmlAttribute("trigger")]
    public bool trigger { get; set; }
    Property Value
    Type Description
    bool

    triggerButton

    The zoom control. Exposed so a caller can drive it directly, or read the wording it uses.

    Declaration
    public ZoomTriggerButton triggerButton { get; }
    Property Value
    Type Description
    ZoomTriggerButton

    triggerMode

    Where the zoom control sits, and how much of the thumbnail it takes.

    Declaration
    [CreateProperty]
    [UxmlAttribute("trigger-mode")]
    public ZoomTriggerMode triggerMode { get; set; }
    Property Value
    Type Description
    ZoomTriggerMode

    Methods

    CloseZoom()

    Dismiss the viewer, if it is open.

    Declaration
    public void CloseZoom()

    GetTriggerModeUssClassName(ZoomTriggerMode)

    Declaration
    public static string GetTriggerModeUssClassName(ZoomTriggerMode enumValue)
    Parameters
    Type Name Description
    ZoomTriggerMode enumValue
    Returns
    Type Description
    string

    OpenZoom()

    Open the viewer, resolving a larger image first if one has been promised.

    Declaration
    public void OpenZoom()

    Implements

    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    RegisterUpdateCallbackExtensions.RegisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    RegisterUpdateCallbackExtensions.UnregisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    VisualElementExtensions.EnableDynamicTransform(VisualElement, bool)
    VisualElementExtensions.EnablePicking(VisualElement, bool)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContextProvider<T>(VisualElement, string)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement, string)
    VisualElementExtensions.GetExclusiveRootElement(VisualElement)
    VisualElementExtensions.GetLastAncestorOfType<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement, string)
    VisualElementExtensions.GetTooltipContent(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.HasAncestorOfType<T>(VisualElement, bool)
    VisualElementExtensions.HasAncestorsOfType<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement, string)
    VisualElementExtensions.IsInvisible(VisualElement)
    VisualElementExtensions.IsOnScreen(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, string, T)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipContent(VisualElement, VisualElementExtensions.TooltipContentCallback)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)