Class CardMedia
The full-bleed cover slot at the top of a Card.
Implements
Inherited Members
VisualElement.Focus()
VisualElement.Overlaps(Rect)
VisualElement.ToString()
VisualElement.TryGetBinding(BindingId, out Binding)
VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
VisualElement.GetFirstOfType<T>()
VisualElement.GetFirstAncestorOfType<T>()
VisualElement.canGrabFocus
VisualElement.focusController
VisualElement.cacheAsBitmap
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.NotifyPropertyChanged(in BindingId)
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class CardMedia : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
Set image to show a texture that covers the box, cropping rather than stretching. With no image the element is an empty inset surface you can fill with any content — a preview render, an Icon, a badge overlay.
CardMedia has no intrinsic height. Give it one through USS or an inline style, or let the content you add to it size the box.
Examples
var media = new CardMedia { image = thumbnail };
media.style.height = 120;
card.Add(media);
Constructors
CardMedia()
Default constructor.
Declaration
public CardMedia()
Fields
imageUssClassName
The styling class of the CardMedia image element.
Declaration
public const string imageUssClassName = "appui-card__media-image"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The CardMedia main styling class.
Declaration
public const string ussClassName = "appui-card__media"
Field Value
| Type | Description |
|---|---|
| string |
Properties
image
The cover texture. null (the default) hides the image element entirely.
Declaration
[Tooltip("The cover texture displayed by this CardMedia.")]
[CreateProperty]
[UxmlAttribute]
public Texture2D image { get; set; }
Property Value
| Type | Description |
|---|---|
| Texture2D |