Interactive Example
The Interactive example demonstrates various interactive widgets working together, including buttons with different styles, checkboxes, list boxes, and progress bars.
What It Demonstrates
Section titled “What It Demonstrates”- Multiple button styles (Standard, Outline, Gradient)
- Checkbox widgets with event handling
- ListBox with selection
- ProgressBar widgets
- ResponsiveContainer for adaptive layouts
- Event handling and state management
Key Features
Section titled “Key Features”Button Styles
Section titled “Button Styles”// Standard buttonvar button1 = new Button("Button 1"){ Style = ButtonStyle.Rounded, BackgroundColor = ColorHelper.FromRgb(66, 135, 245)};
// Outline buttonvar button2 = new Button("Button 2"){ Style = ButtonStyle.Outline, BorderColor = ColorHelper.FromRgb(66, 135, 245)};
// Gradient buttonvar button3 = new Button("Button 3"){ Style = ButtonStyle.Gradient, GradientStartColor = ColorHelper.FromRgb(91, 192, 235), GradientEndColor = ColorHelper.FromRgb(76, 162, 213)};Checkboxes with Events
Section titled “Checkboxes with Events”var checkbox = new Checkbox("Enable feature A");checkbox.CheckedChanged += (isChecked) =>{ statusBar.LeftText = $"Feature A: {(isChecked ? "ON" : "OFF")}";};ListBox Selection
Section titled “ListBox Selection”var listBox = new ListBox();listBox.AddItem("Apple");listBox.AddItem("Banana");
listBox.SelectionChanged += (index) =>{ statusBar.RightText = $"Selected: {listBox.SelectedItem}";};Responsive Layout
Section titled “Responsive Layout”var root = new ResponsiveContainer();root.OnResize((width, height) =>{ // Adjust widget positions based on window size mainFrame.Width = width - (margin * 2); mainFrame.Height = height - margin - 2; // ... layout logic});Running the Example
Section titled “Running the Example”cd examples/Elaris.Examples.Interactivedotnet runLearning Points
Section titled “Learning Points”- Different button styles provide visual variety
- Event handlers allow widgets to communicate
- ResponsiveContainer adapts to window resizing
- Multiple widgets can work together in a single interface
Related Widgets
Section titled “Related Widgets”- Button - Button widget
- Checkbox - Checkbox widget
- ListBox - List box widget
- ProgressBar - Progress bar widget
- ResponsiveContainer - Responsive layout