S&box Wiki




bool AcceptsFocus { get; set; }
Whether this element can accept focus. False by default. If an element accepts focus it'll be able to receive keyboard input.
IEnumerable<Sandbox.UI.StyleSheet> AllStyleSheets { get; }
IEnumerable<Sandbox.UI.Panel> Ancestors { get; }
IEnumerable<Sandbox.UI.Panel> AncestorsAndSelf { get; }
Sandbox.UI.Box Box { get; set; }
int ChildCount { get; }
IEnumerable<Sandbox.UI.Panel> Children { get; }
IEnumerable<string> Class { get; }
A list of classes applied to this panel
string Classes { get; set; }
Sandbox.LibraryAttribute ClassInfo { get; }
We really shouldn't be using the attribute for this, it feels kind of dumb
Sandbox.UI.Styles ComputedStyle { get; }
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.
IEnumerable<Sandbox.UI.Panel> Descendants { get; }
string 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)
Matrix? GlobalMatrix { get; }
If this panel or its parents have transforms, they'll be compounded here.
bool HasActive { get; }
bool HasActiveTransitions { get; }
Return true if this panel has any active transitions
bool HasChildren { get; }
bool HasContent { get; }
bool HasFocus { get; }
bool HasHovered { get; }
bool HasIntro { get; }
bool HasMouseCapture { get; }
bool HasOutro { get; }
bool IsDeleting { get; }
bool IsScrollAtBottom { get; }
bool IsVisible { get; }
Return true if this panel isn't hidden by opacity
bool IsVisibleSelf { get; }
Matrix? LocalMatrix { get; }
If this panel has transforms, they'll be reflected here
Vector2 MousePosition { get; }
Current mouse position local to this panel
float Now { get; }
Sandbox.UI.Panel Parent { get; set; }
bool PreferScrollToBottom { get; set; }
If true, we'll try to stay scrolled to the bottom when the panel changes size
Sandbox.UI.PseudoClass PseudoClass { get; set; }
Special flags used by the styling system for hover, active etc. .
float ScaleFromScreen { get; }
float ScaleToScreen { get; }
Vector2 ScrollOffset { get; set; }
int SiblingIndex { get; }
string StringValue { get; set; }
Sandbox.UI.PanelStyle Style { get; }
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.
Sandbox.UI.Transitions Transitions { get; }
Handles the storage, progression and application of style transitions
object UserData { get; set; }


bool AddChild( T outPanel, string classnames )
void AddClass( string c )
void AddEventListener( string eventName, Action action )
void Bind( Sandbox.UI.DataSource.BaseDataSource binding )
Bind to the data source
bool Blur()
Stop being the focus
IEnumerable<T> ChildrenOfType()
void Delete( bool immediate = False )
Deletes the panel. If immediate is set, will skip any outros.
void DeleteChildren( bool immediate = False )
void FinalLayout()
Takes a LayoutCascade and returns an outer rect
bool Focus()
Sandbox.UI.Panel GetChild( int index, bool loop = False )
string GetClipboardValue( bool cut )
If we have a value that can be copied to the clipboard, return it here.
bool HasClass( string c )
Returns true if we have this class
bool IsAncestor( Sandbox.UI.Panel panel )
Is the passed panel a parent, grandparent etc
bool IsInside( Vector2 pos )
void OnButtonTyped( string button, Sandbox.KeyModifiers km )
void OnDeleted()
void OnHotloaded()
void OnKeyTyped( System.Char k )
void OnLayout( Rect layoutRect )
void OnMouseWheel( float value )
void OnParentChanged()
Called after the parent has changed
void OnPaste( string text )
bool OnTemplateElement( Sandbox.Html.INode element )
If you return true to this call the children from this element won't be created because we'll assume you're doing it youself in your control code
void PlaySound( string sound )
void RemoveClass( string c )
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]
Vector2 ScreenPositionToPanelPosition( Vector2 pos )
Convert a point from the screen to a position relative to the top left of this panel
void SetClass( string c, bool b )
void SetContent( string value )
Called by the templating system when an element has content between its tags.
void SetMouseCapture( bool b )
void SetProperty( string name, string value )
void SetTemplate( string filename )
Set the panel's template. Ideally you won't be using this, you'll be using the [UseTemplate] attribute instead.
void SkipTransitions()
Any traisitons running, or about to run, will jump straight to the end
void SortChildren( Func<Sandbox.UI.Panel, int> sorter )
Sort the children using this comparison function
bool Switch( Sandbox.UI.PseudoClass c, bool state )
Switch a pseudo class on or off
void Tick()
bool TryScroll( float value )
float UnScale( float f )