Description
The None
field of the DisplayMode
enumeration represents a display mode where the element is not displayed at all. This is equivalent to setting the CSS display
property to none
, effectively removing the element from the document layout and rendering tree.
Usage
Use DisplayMode.None
when you want to completely hide an element from the UI, ensuring it does not occupy any space in the layout. This is useful for elements that should be conditionally visible based on certain application logic.
Example
// Example of using DisplayMode.None in a UI component
public class MyComponent : Panel
{
public MyComponent()
{
// Set the display mode to None to hide the component
this.Style.Display = DisplayMode.None;
}
public void ShowComponent()
{
// Change the display mode to Flex to show the component
this.Style.Display = DisplayMode.Flex;
}
}