docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BindingContextElement

    Base class for elements that can generate a UI hierarchy for a given object.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BindableElement
    BindingContextElement
    InspectorElement
    PropertyElement
    Implements
    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IBindable
    Inherited Members
    BindableElement.binding
    BindableElement.bindingPath
    VisualElement.disabledUssClassName
    VisualElement.ExecuteDefaultAction(EventBase)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    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.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.usageHints
    VisualElement.transform
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.parent
    VisualElement.panel
    VisualElement.contentContainer
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    VisualElement.resolvedStyle
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.HandleEvent(EventBase)
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Properties.UI
    Assembly: Unity.Properties.UI.Editor.dll
    Syntax
    public abstract class BindingContextElement : BindableElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IBindable

    Methods

    AddContext(InspectionContext)

    Adds an inspection context to this element.

    Declaration
    public void AddContext(InspectionContext inspectionContext)
    Parameters
    Type Name Description
    InspectionContext inspectionContext

    The inspection context to add.

    Exceptions
    Type Condition
    NullReferenceException

    The inspection context is null.

    ClearTarget()

    Clears the current target and removes all child elements from this element's contentContainer.

    Declaration
    public void ClearTarget()

    ForceReload()

    Clears the current children and re-generates them.

    Declaration
    public void ForceReload()

    GetContext<T>(string)

    Returns an inspection context of the given type.

    Declaration
    public T GetContext<T>(string contextName = null) where T : InspectionContext
    Parameters
    Type Name Description
    string contextName

    The name of the inspection context.

    Returns
    Type Description
    T

    The inspection context, if it exists.

    Type Parameters
    Name Description
    T

    The inspection context type.

    GetTargetType()

    Returns the type of the current target.

    Declaration
    public Type GetTargetType()
    Returns
    Type Description
    Type

    The type of the target.

    GetTarget<T>()

    Gets the target of the BindingContextElement as T.

    Declaration
    public T GetTarget<T>()
    Returns
    Type Description
    T

    The instance of the target.

    Type Parameters
    Name Description
    T

    The type of the target.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when no target has been set.

    InvalidCastException

    Thrown when the target is not of type T.

    GetValue<TValue>(PropertyPath)

    Gets the value of type TValue at the given path.

    Declaration
    public TValue GetValue<TValue>(PropertyPath path)
    Parameters
    Type Name Description
    PropertyPath path

    The property path to the value.

    Returns
    Type Description
    TValue

    The value at path.

    Type Parameters
    Name Description
    TValue

    The value type.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when no target has been set.

    HasContext<T>(string)

    Returns true if an inspection context of the given type exists.

    Declaration
    public bool HasContext<T>(string contextName = null) where T : InspectionContext
    Parameters
    Type Name Description
    string contextName

    The name of the inspection context.

    Returns
    Type Description
    bool

    true, if it exists.

    Type Parameters
    Name Description
    T

    The inspection context type.

    IsPathValid(PropertyPath)

    Returns true if the given path is valid from the target.

    Declaration
    public bool IsPathValid(PropertyPath path)
    Parameters
    Type Name Description
    PropertyPath path

    the property path.

    Returns
    Type Description
    bool

    true if the path is valid.

    RemoveContext(InspectionContext)

    Removes an inspection context from this element.

    Declaration
    public void RemoveContext(InspectionContext inspectionContext)
    Parameters
    Type Name Description
    InspectionContext inspectionContext

    The inspection context to add.

    Exceptions
    Type Condition
    NullReferenceException

    The inspection context is null.

    ArgumentException

    The inspection context was not previously added.

    SetAttributeFilter(AttributeFilterHandler)

    Allows to filter the hierarchy generation based on the field's attributes.

    Declaration
    public void SetAttributeFilter(BindingContextElement.AttributeFilterHandler filter)
    Parameters
    Type Name Description
    BindingContextElement.AttributeFilterHandler filter

    The filter method to apply.

    SetTarget<T>(T)

    Sets the current target.

    Declaration
    public void SetTarget<T>(T target)
    Parameters
    Type Name Description
    T target

    The target to set.

    Type Parameters
    Name Description
    T

    The type of the target.

    Remarks

    This will clear current hierarchy and regenerate a new one.

    SetValue<TValue>(PropertyPath, TValue)

    Sets the value of type TValue at the given path.

    Declaration
    public void SetValue<TValue>(PropertyPath path, TValue value)
    Parameters
    Type Name Description
    PropertyPath path

    The property path to the value.

    TValue value

    the value we want to set.

    Type Parameters
    Name Description
    TValue

    The value type.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when no target has been set.

    TryGetTarget<T>(out T)

    Tries to get the target of the BindingContextElement as an instance of type T.

    Declaration
    public bool TryGetTarget<T>(out T target)
    Parameters
    Type Name Description
    T target

    The target instance.

    Returns
    Type Description
    bool

    true if target was of the correct type; false otherwise.

    Type Parameters
    Name Description
    T

    The type of the target.

    TryGetValue<TValue>(PropertyPath, out TValue)

    Tries to get the value of type TValue at the given path.

    Declaration
    public bool TryGetValue<TValue>(PropertyPath path, out TValue value)
    Parameters
    Type Name Description
    PropertyPath path

    The property path to the value.

    TValue value

    The value at path.

    Returns
    Type Description
    bool

    true if the getting the value was successful.

    Type Parameters
    Name Description
    TValue

    The value type.

    TrySetValue<TValue>(PropertyPath, TValue)

    Tries to set the value of type TValue at the given path.

    Declaration
    public bool TrySetValue<TValue>(PropertyPath path, TValue value)
    Parameters
    Type Name Description
    PropertyPath path

    The property path to the value.

    TValue value

    the value we want to set.

    Returns
    Type Description
    bool

    The value that was effectively set.

    Type Parameters
    Name Description
    TValue

    The value type.

    Events

    OnChanged

    Register to this event to be notified when a change is detected.

    Declaration
    public event BindingContextElement.ChangeHandler OnChanged
    Event Type
    Type Description
    BindingContextElement.ChangeHandler

    Implements

    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IBindable
    In This Article
    Back to top
    Copyright © 2025 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)