s&box docs
API ReferenceSandbox.UI

public class Sandbox.UI.Panel

A simple User Interface panel. Can be styled with CSS.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 3 constructors

Methods

Showing 118 methods

public void AddClass(string classname)

Adds CSS class(es) separated by spaces to this panel.

protected virtual void AddScrollVelocity()

public void BindClass(string className, System.Func`1<bool> func)

public bool Blur()

Remove input focus from this panel.

public virtual void BuildCommandList(Sandbox.Rendering.CommandList commandList)Obsolete

Obsolete: Use Draw

public virtual void BuildContentCommandList(Sandbox.Rendering.CommandList commandList, Sandbox.UI.RenderState state)Obsolete

Obsolete: Use Draw

protected virtual int BuildHash()

By overriding this you can return a hash of variables used by the Razor layout, which will cause a rebuild when changed. This is useful when your layout uses a global variable because by adding it to a HashCode.Combine here you can easily trigger a build when it changes.

Implementations

protected virtual void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder tree)

Overridden/implemented by Razor templating to build a render tree.

public void CancelInvoke(string name)

Cancel a named invocation

public System.Collections.Generic.IEnumerable`1<T> ChildrenOfType()

Returns a list of child panels of given type.

protected virtual void ConstrainScrolling(Vector2 size)

Constrain scrolling to the given size.

protected virtual Sandbox.UI.Panel CreateTooltipPanel()

Create a tooltip panel. You can override this to create a custom tooltip panel. If you're overriding this and not setting `Sandbox.UI.Panel.Tooltip`, then you must override and return true in `Sandbox.UI.Panel.HasTooltip`.

protected void CreateValueEvent(string name, object value)

Call this when the value has changed due to user input etc. This updates any bindings, backwards. Also triggers $"{name}.changed" event, with value being the Value on the event.

public virtual void Delete(bool immediate = False)

Deletes the panel.

Parameters

  • immediate: If , will skip any outros. (`:outro` CSS pseudo class) Default: False

public void DeleteChildren(bool immediate = False)

Deletes all child panels via `Sandbox.UI.Panel.Delete(System.Boolean)`.

Parameters

  • immediate: Default: False

public virtual void DrawBackground(Sandbox.UI.RenderState state)Obsolete

Obsolete: Use Draw

protected void DrawBackgroundTexture(Sandbox.Texture texture, Sandbox.UI.Length defaultSize)

Draws a texture using this panel's CSS box styling (border radius, border image, background position/size, tint, blend mode, filter mode, etc.) and adds the resulting descriptor to `Sandbox.UI.Panel.CachedDescriptors`. This is intended for controls like `Sandbox.UI.Image`, `Sandbox.UI.ScenePanel`, and `Sandbox.UI.SvgPanel` that render a texture as their primary content while respecting the panel's CSS properties. For simple texture drawing without CSS styling, use `Sandbox.UI.Panel.Draw.Texture(Sandbox.Texture,Sandbox.Rect,System.Nullable)` instead.

Parameters

  • texture: The texture to draw. If null or invalid, draws the styled box without a texture.
  • defaultSize: Controls how the texture is sized within the panel (e.g. `Sandbox.UI.Length.Cover`, `Sandbox.UI.Length.Contain`, `Sandbox.UI.Length.Auto`).

public virtual void DrawContent(Sandbox.UI.RenderState state)Obsolete

Obsolete: Use Draw

protected void EmptyStateChanged()

Should be called if overriding IsEmpty to notify the panel that its empty state has changed.

public virtual void FinalLayout(Vector2 offset)

Takes a `Sandbox.UI.LayoutCascade` and returns an outer rect

protected virtual void FinalLayoutChildren(Vector2 offset)

Layout the children of this panel.

Parameters

  • offset: The parent's position.

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> FindInRect(Sandbox.Rect box, bool fullyInside)

Find and return any children of this panel (including self) within the given rect.

Parameters

  • box: The area to look for panels in, in screen-space coordinates.
  • fullyInside: Whether we want only the panels that are completely within the given bounds.

public virtual Sandbox.UI.Panel FindPopupPanel()

Returns the first ancestor panel that has no parent.

public Sandbox.UI.RootPanel FindRootPanel()

Returns the `Sandbox.UI.RootPanel` we are ultimately attached to, if any.

public void FlashClass(string classname, float seconds)

Add a class for a set amount of seconds. If called multiple times, we will stomp the earlier call.

public bool Focus()

Give input focus to this panel.

public string GetAttribute(string k, string defaultIfNotFound = null)

Used in templates, try to get the attribute that was set in creation.

Parameters

  • defaultIfNotFound: Default: null

public Sandbox.UI.Panel GetChild(int index, bool loop = False)

Return a child at given index.

Parameters

  • index: Index at which to look.
  • loop: Whether to loop indices when out of bounds, i.e. -1 becomes last child, 11 becomes second child in a list of 10, etc. Default: False

Returns

Returns the requested child, or if it was not found.

public int GetChildIndex(Sandbox.UI.Panel panel)

Returns the index at which the given panel is parented to this panel, or -1 if it is not.

public virtual string GetClipboardValue(bool cut)

If we have a value that can be copied to the clipboard, return it here.

protected virtual string GetRenderTreeChecksum()

Overridden/implemented by Razor templating, contains render tree checksum to determine when the render tree content has changed.

public virtual Vector2 GetTransformPosition(Vector2 pos)

Called by `Sandbox.UI.PanelInput.CheckHover(Sandbox.UI.Panel,Vector2,Sandbox.UI.Panel@)` to transform the current mouse position using the panel's LocalMatrix (by default). This can be overriden for special cases.

public bool HasClass(string classname)

Whether we have the given CSS class or not.

protected virtual void InitializeEvents()

Called on creation and hotload to delete and re-initialize event listeners.

public void Invoke(float seconds, System.Action action)

Invoke a method after a delay. If the panel is deleted before this delay the method will not be called.

public void InvokeOnce(string name, float seconds, System.Action action)

Invoke a method after a delay. If the panel is deleted before this delay the method will not be called. If the invoke is called while the old one is waiting, the old one will be cancelled.

public bool IsAncestor(Sandbox.UI.Panel panel)

Is the given panel a parent, grandparent, etc.

protected virtual bool IsPanelEmpty()

Can be overridden by children to determine whether the panel is empty, and the :empty pseudo-class should be applied.

public virtual void LanguageChanged()

Called when the current language has changed. This allows you to rebuild anything that might need rebuilding. Tokenized text labels should automatically update.

public void MarkRenderDirty()

public void MoveAfterSibling(Sandbox.UI.Panel previousSibling)

Move this panel to be after the given sibling.

protected virtual void OnAfterTreeRender(bool firstTime)

Called after the razor tree has been created/rendered.

Implementations

protected virtual void OnBack(Sandbox.UI.PanelEvent e)

Called when the player presses the "Back" button while hovering this panel, which is typically "mouse 5", aka one of the mouse buttons on its side.

protected virtual void OnBlur(Sandbox.UI.PanelEvent e)

Called when this panel loses input focus.

public virtual void OnButtonEvent(Sandbox.UI.ButtonEvent e)

Called when any button, mouse (except for mouse4/5) and keyboard, are pressed or depressed while hovering this panel.

Implementations

public virtual void OnButtonTyped(Sandbox.UI.ButtonEvent e)

Called when any keyboard button has been typed (pressed) while this panel has input focus. (`Sandbox.UI.Panel.Focus`)

protected virtual void OnChildAdded(Sandbox.UI.Panel child)

A child panel has been added to this panel.

protected virtual void OnChildRemoved(Sandbox.UI.Panel child)

A child panel has been removed from this panel.

protected virtual void OnClick(Sandbox.UI.MousePanelEvent e)

Called when the player releases their left mouse button (Mouse 1) while hovering this panel.

public virtual void OnDeleted()

Called when the panel is about to be deleted.

protected virtual void OnDoubleClick(Sandbox.UI.MousePanelEvent e)

Called when the player double clicks the panel with the left mouse button.

protected virtual void OnDrag(Sandbox.UI.DragEvent e)

protected virtual void OnDragEnd(Sandbox.UI.DragEvent e)

protected virtual void OnDragEnter(Sandbox.UI.PanelEvent e)

Called when a panel is being dragged over this panel. Fires continuously as the cursor moves.

protected virtual void OnDragLeave(Sandbox.UI.PanelEvent e)

Called when a panel being dragged leaves this panel's bounds.

protected virtual void OnDragSelect(Sandbox.UI.SelectionEvent e)

Called when the player moves the mouse after "press and holding" (or dragging) the panel.

protected virtual void OnDragStart(Sandbox.UI.DragEvent e)

public virtual void OnDraw()

Override this to draw custom graphics for this panel using the `Sandbox.UI.Panel.Draw` API. public override void OnDraw() { var r = Box.RectInner; Draw.Rect( r, Color.Blue.WithAlpha( 0.2f ), cornerRadius: 4 ); Draw.Text( "Score: 100", r, 16, Color.White, TextFlag.Center ); }

protected virtual void OnDrop(Sandbox.UI.PanelEvent e)

Called when a dragged panel is released over this panel.

protected virtual void OnEscape(Sandbox.UI.PanelEvent e)

Called when the escape key is pressed

protected virtual void OnEvent(Sandbox.UI.PanelEvent e)

Called when various `Sandbox.UI.PanelEvent`s happen. Handles event listeners and many standard events by default.

protected virtual void OnFocus(Sandbox.UI.PanelEvent e)

Called when this panel receives input focus.

protected virtual void OnForward(Sandbox.UI.PanelEvent e)

Called when the player presses the "Forward" button while hovering this panel, which is typically "mouse 4", aka one of the mouse buttons on its side.

public virtual void OnHotloaded()

Called when a hotload happened. (Not necessarily on this panel)

public virtual void OnKeyTyped(char k)

Called when a printable character has been typed (pressed) while this panel has input focus. (`Sandbox.UI.Panel.Focus`)

public virtual void OnLayout(Sandbox.Rect layoutRect)

This panel has just been laid out. You can modify its position now and it will affect its children. This is a useful place to restrict shit to the screen etc.

protected virtual void OnMiddleClick(Sandbox.UI.MousePanelEvent e)

Called when the player releases their middle mouse button (Mouse 3) while hovering this panel.

protected virtual void OnMouseDown(Sandbox.UI.MousePanelEvent e)

Called when the player presses down the left or right mouse buttons while hovering this panel.

Implementations

protected virtual void OnMouseMove(Sandbox.UI.MousePanelEvent e)

Called when the cursor moves while hovering this panel.

protected virtual void OnMouseOut(Sandbox.UI.MousePanelEvent e)

Called when the cursor leaves this panel.

protected virtual void OnMouseOver(Sandbox.UI.MousePanelEvent e)

Called when the cursor enters this panel.

protected virtual void OnMouseUp(Sandbox.UI.MousePanelEvent e)

Called when the player releases left or right mouse button.

public virtual void OnMouseWheel(Vector2 value)

Called when the player scrolls their mouse wheel while hovering this panel.

Parameters

  • value: The scroll wheel delta. Positive values are scrolling down, negative - up.

Implementations

protected virtual void OnParametersSet()

Called after all templated panel binds have been set.

Implementations

protected virtual System.Threading.Tasks.Task OnParametersSetAsync()

Called after all templated panel binds have been set.

public virtual void OnParentChanged()

Called after the parent of this panel has changed.

public virtual void OnPaste(string text)

Called when the user presses CTRL+V while this panel has input focus.

public void OnRenderFragmentChanged(Sandbox.UI.Panel upTo)

A RenderFragment has been set on us, so our tree has potential changes now. Lets update and see.

protected virtual void OnRightClick(Sandbox.UI.MousePanelEvent e)

Called when the player releases their right mouse button (Mouse 2) while hovering this panel.

public virtual void OnTemplateSlot(Sandbox.Html.INode element, string slotName, Sandbox.UI.Panel panel)

TODO: Obsolete this and instead maybe we have something like [PanelSlot( "slotname" )] that is applied on properties. Then when we find a slot="slotname" we chase up the heirachy and set the property.

protected virtual void OnVisibilityChanged()

Called when the visibility of the current panel changes. This could be because our own style changed, or a parent style. You can check visibility using `Sandbox.UI.Panel.IsVisible` and `Sandbox.UI.Panel.IsVisibleSelf`.

public Vector2 PanelPositionToScreenPosition(Vector2 pos)

Convert a point from local space to screen space

public void PlaySound(string sound)

Play a sound from this panel.

public virtual bool RayToLocalPosition(Ray ray, Vector2 position, float distance)

Transform a ray in 3D space to a position on the panel. This is used for world panel input.

Parameters

  • ray: The ray in 3D world space to test against this panel.
  • position: Position on the panel where the intersection happened, local to the panel's top left corner.
  • distance: Distance from the ray's origin to the intersection in 3D space.

Returns

Return true if a hit/intersection was detected.

public void RemoveClass(string classname)

Removes given CSS class from this panel.

public Vector2 ScreenPositionToPanelDelta(Vector2 pos)

Convert a point from the screen to a point representing a delta on this panel where the top left is [0,0] and the bottom right is [1,1]

public Vector2 ScreenPositionToPanelPosition(Vector2 pos)

Convert a point from the screen to a position relative to the top left of this panel

public void SelectAllInChildren()

If AllowChildSelection is enabled, we'll try to select all children text

public void SetAttribute(string k, string v)

Used in templates, gets an attribute that was set in the template.

public void SetChildIndex(Sandbox.UI.Panel child, int newIndex)

Move given child panel to be given index, where 0 is the first child.

public void SetClass(string classname, bool active)

Sets a specific CSS class active or not.

public virtual void SetContent(string value)

Called by the templating system when an element has content between its tags.

public void SetMouseCapture(bool b)

Captures the mouse cursor while active. The cursor will be hidden and will be stuck in place. You will want to use `Sandbox.Mouse.Delta` in `Sandbox.UI.Panel.Tick` while `Sandbox.UI.Panel.HasMouseCapture` to read mouse movements.You can call this from `Sandbox.UI.Panel.OnButtonEvent(Sandbox.UI.ButtonEvent)` for mouse clicks.

Parameters

  • b: Whether to enable or disable the capture.

public virtual void SetProperty(string name, string value)

Set a property on the panel, such as special properties (`class`, `id`, `style` and `value`, etc.) and properties of the panel's C# class.

Parameters

  • name: name of the property to modify.
  • value: Value to assign to the property.

public virtual void SetPropertyObject(string name, object value)

Same as `Sandbox.UI.Panel.SetProperty(System.String,System.String)`, but first tries to set the property on the panel object, then process any special properties such as `class`.

public void SkipTransitions()

Any transitions running, or about to run, will jump straight to the end.

public void StateHasChanged()

For razor panels, call when the state of the render tree has changed such that it would be a good idea to re-render the tree. You would usually not need to call this manually.

protected void StyleSelectorsChanged(bool ancestors, bool descendants, Sandbox.UI.RootPanel root = null)

Should be called when something happens that means that this panel's stylesheets need to be re-evaluated. Like becoming hovered or classes changed. You don't call this when changing styles directly on the panel, just on anything that will change which stylesheets should get selected.

Parameters

  • ancestors: Also re-evaluate all ancestor panels. (for `:has()`)
  • descendants: Also re-evaluate all child panels. (for parent selectors)
  • root: Root panel cache so we don't need to keep looking it up. Default: null

public bool Switch(Sandbox.UI.PseudoClass c, bool state)

Switch a pseudo class on or off.

public virtual void Tick()

Called every frame. This is your "Think" function.

Implementations

public void ToggleClass(string classname)

Add a class if we don't have it, remove a class if we do have it

public bool TryFindKeyframe(string name, Sandbox.UI.KeyFrames keyframes)

Try to find `@keyframes` CSS rule with given name in `Sandbox.UI.Panel.AllStyleSheets`.

Parameters

  • name: The name to search for.
  • keyframes: The keyframes, if any are found, or .

Returns

if `@keyframes` with given name were found.

public bool TryScroll(Vector2 value)

Called from `Sandbox.UI.Panel.OnMouseWheel(Vector2)` to try to scroll.

Parameters

  • value: The scroll wheel delta. Positive values are scrolling down, negative - up.

Returns

Return true to NOT propagate the event to the `Sandbox.UI.Panel.Parent`.

public bool TryScrollToBottom()

Scroll to the bottom, if the panel has scrolling enabled.

Returns

Whether we scrolled to the bottom or not.

public void UnselectAllInChildren()

Clear any selection in children

public virtual bool WantsMouseInput()

Returns true if this panel would like the mouse cursor to be visible.

Properties

Showing 63 properties

public bool Sandbox.UI.Panel.AcceptsFocus { get; set; }

False by default, can this element accept keyboard focus. If an element accepts focus it'll be able to receive keyboard input.

public virtual bool Sandbox.UI.Panel.AcceptsImeInput { get; set; }

False by default. Anything that is capable of accepting IME input should return true. Which is probably just a TextEntry.

public virtual sealed System.Collections.Generic.IEnumerable`1<Sandbox.UI.IStyleBlock> Sandbox.UI.Panel.ActiveStyleBlocks { get; set; }

A importance sorted list of style blocks that are active on this panel

public Sandbox.UI.Construct.PanelCreator Sandbox.UI.Panel.Add { get; set; }

Quickly add common panels with certain values as children.

public bool Sandbox.UI.Panel.AllowChildSelection { get; set; }

Allow selecting child text

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.StyleSheet> Sandbox.UI.Panel.AllStyleSheets { get; set; }

List of all `Sandbox.UI.StyleSheet`s applied to this panel and all its ancestors.

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Ancestors { get; set; }

Returns all ancestors, i.e. the parent, parent of our parent, etc.

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.AncestorsAndSelf { get; set; }

Returns this panel and all its ancestors, i.e. the Parent, parent of its parent, etc.

public Sandbox.UI.Box Sandbox.UI.Panel.Box { get; set; }

Access to various bounding boxes of this panel.

public virtual sealed Sandbox.UI.PanelInputType Sandbox.UI.Panel.ButtonInput { get; set; }

Describe what to do with keyboard input. The default is InputMode.UI which means that when focused, this panel will receive Keys Typed and Button Events. If you set this to InputMode.Game, this panel will redirect its inputs to the game, which means for example that if you're focused on this panel and press space, it'll send the jump button to the game.

public bool Sandbox.UI.Panel.CanDragScroll { get; set; }

Set this to false if you want to opt out of drag scrolling

public Microsoft.AspNetCore.Components.RenderFragment Sandbox.UI.Panel.ChildContent { get; set; }

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Children { get; set; }

List of panels that are attached/parented directly to this one.

public int Sandbox.UI.Panel.ChildrenCount { get; set; }

Amount of panels directly parented to this panel.

public System.Collections.Generic.IEnumerable`1<string> Sandbox.UI.Panel.Class { get; set; }

A list of CSS classes applied to this panel.

public string Sandbox.UI.Panel.Classes { get; set; }

All CSS classes applied to this panel, separated with spaces.

public Sandbox.UI.Styles Sandbox.UI.Panel.ComputedStyle { get; set; }

This is the style that we computed last. If you're looking to see which styles are set on this panel then this is what you're looking for.

public System.Threading.CancellationToken Sandbox.UI.Panel.DeletionToken { get; set; }

Get a token that is cancelled when the panel is deleted

public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Descendants { get; set; }

List of all panels that are attached to this panel, recursively, i.e. all children of this panel, children of those children, etc.

public string Sandbox.UI.Panel.ElementName { get; set; }

The element name. If you've created this Panel via a template this will be whatever the element name is on there. If not then it'll be the name of the class (ie Panel, Button)

public System.Nullable`1<Matrix> Sandbox.UI.Panel.GlobalMatrix { get; set; }

If this panel or its parents have transforms, they'll be compounded here.

public bool Sandbox.UI.Panel.HasActive { get; set; }

Whether this panel has the `:active` pseudo class active.

public bool Sandbox.UI.Panel.HasActiveTransitions { get; set; }

Returns true if this panel has any active CSS transitions.

public bool Sandbox.UI.Panel.HasChildren { get; set; }

Whether this panel has any child panels at all.

public virtual bool Sandbox.UI.Panel.HasContent { get; set; }Obsolete

If true, calls `Sandbox.UI.Panel.DrawContent(Sandbox.UI.PanelRenderer,Sandbox.UI.RenderState@)`.

Obsolete: Use Draw

public bool Sandbox.UI.Panel.HasFocus { get; set; }

Whether this panel has the `:focus` pseudo class active.

public bool Sandbox.UI.Panel.HasHovered { get; set; }

Whether this panel has the `:hover` pseudo class active.

public bool Sandbox.UI.Panel.HasIntro { get; set; }

Whether this panel has the `:intro` pseudo class active.

public bool Sandbox.UI.Panel.HasMouseCapture { get; set; }

Whether this panel is capturing the mouse cursor. See `Sandbox.UI.Panel.SetMouseCapture(System.Boolean)`.

public bool Sandbox.UI.Panel.HasOutro { get; set; }

Whether this panel has the `:outro` pseudo class active.

public bool Sandbox.UI.Panel.HasScrollX { get; set; }

Return true if this panel is scrollable on the X axis

public bool Sandbox.UI.Panel.HasScrollY { get; set; }

Return true if this panel is scrollable on the Y axis

public virtual bool Sandbox.UI.Panel.HasTooltip { get; set; }

You should override and return true if you're overriding `Sandbox.UI.Panel.CreateTooltipPanel`. Otherwise this will return true if `Sandbox.UI.Panel.Tooltip` is not empty.

public virtual sealed string Sandbox.UI.Panel.Id { get; set; }

Works the same as the html id="" attribute. If you set Id to "poop", it'll match any styles that define #poop in their selector.

public bool Sandbox.UI.Panel.IsDeleting { get; set; }

Whether `Sandbox.UI.Panel.Delete(System.Boolean)` was called on this panel.

public bool Sandbox.UI.Panel.IsDragScrolling { get; set; }

Is this panel currently being scrolled by dragging?

public bool Sandbox.UI.Panel.IsScrollAtBottom { get; set; }

Whether the scrolling is currently pinned to the bottom of the panel as dictated by `Sandbox.UI.Panel.PreferScrollToBottom`.

public virtual sealed bool Sandbox.UI.Panel.IsValid { get; set; }

public bool Sandbox.UI.Panel.IsVisible { get; set; }

Return true if this panel isn't hidden by opacity or displaymode.

public bool Sandbox.UI.Panel.IsVisibleSelf { get; set; }

Return true if this panel isn't hidden by opacity or displaymode.

public System.Nullable`1<Matrix> Sandbox.UI.Panel.LocalMatrix { get; set; }

If this panel has transforms, they'll be reflected here

public Vector2 Sandbox.UI.Panel.MousePosition { get; set; }

Current mouse position local to this panels top left corner.

public float Sandbox.UI.Panel.Opacity { get; set; }

The currently calculated opacity. This is set by multiplying our current style opacity with our parent's opacity.

public Sandbox.UI.Panel Sandbox.UI.Panel.Parent { get; set; }

The panel we are directly attached to. This panel will be positioned relative to the given parent, and therefore move with it, typically also be hidden by the parents bounds.

public bool Sandbox.UI.Panel.PreferScrollToBottom { get; set; }

If true, we'll try to stay scrolled to the bottom when the panel changes size

public float Sandbox.UI.Panel.ScaleFromScreen { get; set; }

Inverse scale of `Sandbox.UI.Panel.ScaleToScreen`.

public float Sandbox.UI.Panel.ScaleToScreen { get; set; }

Scale of the panel on the screen.

public Sandbox.Scene Sandbox.UI.Panel.Scene { get; set; }

Returns the scene that this panel belongs to

public Vector2 Sandbox.UI.Panel.ScrollOffset { get; set; }

Offset of the panel's children position for scrolling purposes.

public Vector2 Sandbox.UI.Panel.ScrollSize { get; set; }

The size of the scrollable area within this panel.

public int Sandbox.UI.Panel.SiblingIndex { get; set; }

The index of this panel in its parent's child list.

public virtual sealed string Sandbox.UI.Panel.SourceFile { get; set; }

If this was created by razor, this is the file in which it was created

public virtual sealed int Sandbox.UI.Panel.SourceLine { get; set; }

If this was created by razor, this is the line number in the file

public virtual string Sandbox.UI.Panel.StringValue { get; set; }

Set via `"value"` property from HTML.

public Sandbox.UI.PanelStyle Sandbox.UI.Panel.Style { get; set; }

Allows you to set styles specifically on this panel. Setting the style will only affect this panel and no others and will override any other styles.

public string Sandbox.UI.Panel.Tooltip { get; set; }

A string to show when hovering over this panel.

public string Sandbox.UI.Panel.TooltipClass { get; set; }

The created tooltip element will have this class, if set.

public object Sandbox.UI.Panel.UserData { get; set; }

Can be used to store random data without sub-classing the panel.

public virtual bool Sandbox.UI.Panel.WantsDrag { get; set; }

Return true if this panel wants to be dragged

protected virtual bool Sandbox.UI.Panel.WantsDragScrolling { get; set; }

Metadata

FieldValue
NamespaceSandbox.UI
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.UI.Panel

On this page

Constructorspublic Panel()public Panel(Sandbox.UI.Panel parent, System.String classnames)public Panel(Sandbox.UI.Panel parent)Methodspublic T AddChild(T p)public System.Boolean AddChild(T outPanel, System.String classnames = null)public T AddChild(System.String classnames = null)public System.Void AddClass(System.String classname)public System.Void AddEventListener(System.String eventName, System.Action action)public System.Void AddEventListener(System.String eventName, System.Action`1<Sandbox.UI.PanelEvent> e)protected virtual System.Void AddScrollVelocity()public System.Void BindClass(System.String className, System.Func`1<System.Boolean> func)public System.Boolean Blur()public virtual System.Void BuildCommandList(Sandbox.Rendering.CommandList commandList)public virtual System.Void BuildContentCommandList(Sandbox.Rendering.CommandList commandList, Sandbox.UI.RenderState state)protected virtual System.Int32 BuildHash()protected virtual System.Void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder tree)public System.Void CancelInvoke(System.String name)public System.Collections.Generic.IEnumerable`1<T> ChildrenOfType()protected virtual System.Void ConstrainScrolling(Vector2 size)public virtual System.Void CreateEvent(Sandbox.UI.PanelEvent evnt)public virtual System.Void CreateEvent(System.String name, System.Object value = null, System.Nullable`1<System.Single> debounce = null)protected virtual Sandbox.UI.Panel CreateTooltipPanel()protected System.Void CreateValueEvent(System.String name, System.Object value)public virtual System.Void Delete(System.Boolean immediate = False)public System.Void DeleteChildren(System.Boolean immediate = False)public virtual System.Void DrawBackground(Sandbox.UI.RenderState state)protected System.Void DrawBackgroundTexture(Sandbox.Texture texture, Sandbox.UI.Length defaultSize)public virtual System.Void DrawContent(Sandbox.UI.RenderState state)protected System.Void EmptyStateChanged()public virtual System.Void FinalLayout(Vector2 offset)protected virtual System.Void FinalLayoutChildren(Vector2 offset)public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> FindInRect(Sandbox.Rect box, System.Boolean fullyInside)public virtual Sandbox.UI.Panel FindPopupPanel()public Sandbox.UI.RootPanel FindRootPanel()public System.Void FlashClass(System.String classname, System.Single seconds)public System.Boolean Focus()public System.String GetAttribute(System.String k, System.String defaultIfNotFound = null)public Sandbox.UI.Panel GetChild(System.Int32 index, System.Boolean loop = False)public System.Int32 GetChildIndex(Sandbox.UI.Panel panel)public virtual System.String GetClipboardValue(System.Boolean cut)protected virtual System.String GetRenderTreeChecksum()public virtual Vector2 GetTransformPosition(Vector2 pos)public System.Boolean HasClass(System.String classname)protected virtual System.Void InitializeEvents()public System.Void Invoke(System.Single seconds, System.Action action)public System.Void InvokeOnce(System.String name, System.Single seconds, System.Action action)public System.Boolean IsAncestor(Sandbox.UI.Panel panel)public System.Boolean IsInside(Sandbox.Rect rect, System.Boolean fullyInside)public System.Boolean IsInside(Vector2 pos)protected virtual System.Boolean IsPanelEmpty()public virtual System.Void LanguageChanged()public System.Void MarkRenderDirty()public System.Void MoveAfterSibling(Sandbox.UI.Panel previousSibling)protected virtual System.Void OnAfterTreeRender(System.Boolean firstTime)protected virtual System.Void OnBack(Sandbox.UI.PanelEvent e)protected virtual System.Void OnBlur(Sandbox.UI.PanelEvent e)public virtual System.Void OnButtonEvent(Sandbox.UI.ButtonEvent e)public virtual System.Void OnButtonTyped(Sandbox.UI.ButtonEvent e)protected virtual System.Void OnChildAdded(Sandbox.UI.Panel child)protected virtual System.Void OnChildRemoved(Sandbox.UI.Panel child)protected virtual System.Void OnClick(Sandbox.UI.MousePanelEvent e)public virtual System.Void OnDeleted()protected virtual System.Void OnDoubleClick(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnDrag(Sandbox.UI.DragEvent e)protected virtual System.Void OnDragEnd(Sandbox.UI.DragEvent e)protected virtual System.Void OnDragEnter(Sandbox.UI.PanelEvent e)protected virtual System.Void OnDragLeave(Sandbox.UI.PanelEvent e)protected virtual System.Void OnDragSelect(Sandbox.UI.SelectionEvent e)protected virtual System.Void OnDragStart(Sandbox.UI.DragEvent e)public virtual System.Void OnDraw()protected virtual System.Void OnDrop(Sandbox.UI.PanelEvent e)protected virtual System.Void OnEscape(Sandbox.UI.PanelEvent e)protected virtual System.Void OnEvent(Sandbox.UI.PanelEvent e)protected virtual System.Void OnFocus(Sandbox.UI.PanelEvent e)protected virtual System.Void OnForward(Sandbox.UI.PanelEvent e)public virtual System.Void OnHotloaded()public virtual System.Void OnKeyTyped(System.Char k)public virtual System.Void OnLayout(Sandbox.Rect layoutRect)protected virtual System.Void OnMiddleClick(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnMouseDown(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnMouseMove(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnMouseOut(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnMouseOver(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnMouseUp(Sandbox.UI.MousePanelEvent e)public virtual System.Void OnMouseWheel(Vector2 value)protected virtual System.Void OnParametersSet()protected virtual System.Threading.Tasks.Task OnParametersSetAsync()public virtual System.Void OnParentChanged()public virtual System.Void OnPaste(System.String text)public System.Void OnRenderFragmentChanged(Sandbox.UI.Panel upTo)protected virtual System.Void OnRightClick(Sandbox.UI.MousePanelEvent e)public virtual System.Void OnTemplateSlot(Sandbox.Html.INode element, System.String slotName, Sandbox.UI.Panel panel)protected virtual System.Void OnVisibilityChanged()public Vector2 PanelPositionToScreenPosition(Vector2 pos)public System.Void PlaySound(System.String sound)public virtual System.Boolean RayToLocalPosition(Ray ray, Vector2 position, System.Single distance)public System.Void RemoveClass(System.String classname)public Vector2 ScreenPositionToPanelDelta(Vector2 pos)public Vector2 ScreenPositionToPanelPosition(Vector2 pos)public System.Void SelectAllInChildren()public System.Void SetAttribute(System.String k, System.String v)public System.Void SetChildIndex(Sandbox.UI.Panel child, System.Int32 newIndex)public System.Void SetClass(System.String classname, System.Boolean active)public virtual System.Void SetContent(System.String value)public System.Void SetMouseCapture(System.Boolean b)public virtual System.Void SetProperty(System.String name, System.String value)public virtual System.Void SetPropertyObject(System.String name, System.Object value)public System.Void SkipTransitions()public System.Void SortChildren(System.Comparison`1<Sandbox.UI.Panel> sorter)public System.Void SortChildren(System.Func`2<Sandbox.UI.Panel,System.Int32> sorter)public System.Void SortChildren(System.Func`2<TargetType,System.Int32> sorter)public System.Void StateHasChanged()protected System.Void StyleSelectorsChanged(System.Boolean ancestors, System.Boolean descendants, Sandbox.UI.RootPanel root = null)public System.Boolean Switch(Sandbox.UI.PseudoClass c, System.Boolean state)public virtual System.Void Tick()public System.Void ToggleClass(System.String classname)public System.Boolean TryFindKeyframe(System.String name, Sandbox.UI.KeyFrames keyframes)public System.Boolean TryScroll(Vector2 value)public System.Boolean TryScrollToBottom()public System.Void UnselectAllInChildren()public virtual System.Boolean WantsMouseInput()Propertiespublic System.Boolean Sandbox.UI.Panel.AcceptsFocus { get; set; }public virtual System.Boolean Sandbox.UI.Panel.AcceptsImeInput { get; set; }public virtual sealed System.Collections.Generic.IEnumerable`1<Sandbox.UI.IStyleBlock> Sandbox.UI.Panel.ActiveStyleBlocks { get; set; }public Sandbox.UI.Construct.PanelCreator Sandbox.UI.Panel.Add { get; set; }public System.Boolean Sandbox.UI.Panel.AllowChildSelection { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.UI.StyleSheet> Sandbox.UI.Panel.AllStyleSheets { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Ancestors { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.AncestorsAndSelf { get; set; }public Sandbox.UI.Box Sandbox.UI.Panel.Box { get; set; }public virtual sealed Sandbox.UI.PanelInputType Sandbox.UI.Panel.ButtonInput { get; set; }public System.Boolean Sandbox.UI.Panel.CanDragScroll { get; set; }public Microsoft.AspNetCore.Components.RenderFragment Sandbox.UI.Panel.ChildContent { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Children { get; set; }public System.Int32 Sandbox.UI.Panel.ChildrenCount { get; set; }public System.Collections.Generic.IEnumerable`1<System.String> Sandbox.UI.Panel.Class { get; set; }public System.String Sandbox.UI.Panel.Classes { get; set; }public Sandbox.UI.Styles Sandbox.UI.Panel.ComputedStyle { get; set; }public System.Threading.CancellationToken Sandbox.UI.Panel.DeletionToken { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.UI.Panel> Sandbox.UI.Panel.Descendants { get; set; }public System.String Sandbox.UI.Panel.ElementName { get; set; }public Sandbox.GameObject Sandbox.UI.Panel.GameObject { get; set; }public System.Nullable`1<Matrix> Sandbox.UI.Panel.GlobalMatrix { get; set; }public System.Boolean Sandbox.UI.Panel.HasActive { get; set; }public System.Boolean Sandbox.UI.Panel.HasActiveTransitions { get; set; }public System.Boolean Sandbox.UI.Panel.HasChildren { get; set; }public virtual System.Boolean Sandbox.UI.Panel.HasContent { get; set; }public System.Boolean Sandbox.UI.Panel.HasFocus { get; set; }public System.Boolean Sandbox.UI.Panel.HasHovered { get; set; }public System.Boolean Sandbox.UI.Panel.HasIntro { get; set; }public System.Boolean Sandbox.UI.Panel.HasMouseCapture { get; set; }public System.Boolean Sandbox.UI.Panel.HasOutro { get; set; }public System.Boolean Sandbox.UI.Panel.HasScrollX { get; set; }public System.Boolean Sandbox.UI.Panel.HasScrollY { get; set; }public virtual System.Boolean Sandbox.UI.Panel.HasTooltip { get; set; }public virtual sealed System.String Sandbox.UI.Panel.Id { get; set; }public System.Boolean Sandbox.UI.Panel.IsDeleting { get; set; }public System.Boolean Sandbox.UI.Panel.IsDragScrolling { get; set; }public System.Boolean Sandbox.UI.Panel.IsScrollAtBottom { get; set; }public virtual sealed System.Boolean Sandbox.UI.Panel.IsValid { get; set; }public System.Boolean Sandbox.UI.Panel.IsVisible { get; set; }public System.Boolean Sandbox.UI.Panel.IsVisibleSelf { get; set; }public System.Nullable`1<Matrix> Sandbox.UI.Panel.LocalMatrix { get; set; }public Vector2 Sandbox.UI.Panel.MousePosition { get; set; }public System.Single Sandbox.UI.Panel.Opacity { get; set; }public Sandbox.UI.Panel Sandbox.UI.Panel.Parent { get; set; }public System.Boolean Sandbox.UI.Panel.PreferScrollToBottom { get; set; }public virtual sealed Sandbox.UI.PseudoClass Sandbox.UI.Panel.PseudoClass { get; set; }public System.Single Sandbox.UI.Panel.ScaleFromScreen { get; set; }public System.Single Sandbox.UI.Panel.ScaleToScreen { get; set; }public Sandbox.Scene Sandbox.UI.Panel.Scene { get; set; }public Vector2 Sandbox.UI.Panel.ScrollOffset { get; set; }public Vector2 Sandbox.UI.Panel.ScrollSize { get; set; }public System.Int32 Sandbox.UI.Panel.SiblingIndex { get; set; }public virtual sealed System.String Sandbox.UI.Panel.SourceFile { get; set; }public virtual sealed System.Int32 Sandbox.UI.Panel.SourceLine { get; set; }public virtual System.String Sandbox.UI.Panel.StringValue { get; set; }public Sandbox.UI.PanelStyle Sandbox.UI.Panel.Style { get; set; }public System.String Sandbox.UI.Panel.Tooltip { get; set; }public System.String Sandbox.UI.Panel.TooltipClass { get; set; }public Sandbox.UI.Transitions Sandbox.UI.Panel.Transitions { get; set; }public System.Object Sandbox.UI.Panel.UserData { get; set; }public virtual System.Boolean Sandbox.UI.Panel.WantsDrag { get; set; }protected virtual System.Boolean Sandbox.UI.Panel.WantsDragScrolling { get; set; }Metadata