Choose by the data and interaction you need, then customize appearance through styles and templates. Every control in the table is available the same way in declarative Rust and in XAML: button() or Button { .. } in rsx!, and <Button /> in markup, with the same properties; the TreeDataGrid’s builders come with the treedatagrid feature of ferroui-view.
| Task | Start with | Considerations |
|---|---|---|
| Trigger an action | Button | Use a command for application logic |
| Toggle an option | CheckBox or ToggleSwitch | CheckBox can represent an indeterminate state |
| Choose one of a few options | RadioButton | Use a named group for mutually exclusive choices |
| Choose from a compact list | ComboBox | Preserve a meaningful selected item |
| Edit text | TextBox | Set wrapping, acceptance of returns, and validation deliberately |
| Display text | TextBlock | Avoid a read-only TextBox for simple labels |
| Choose a numeric range value | Slider or NumericUpDown | Slider favors approximate adjustment; numeric input favors precision |
| Show selectable records | ListBox | Use templates and collection notifications |
| Show hierarchical tabular data | TreeDataGrid | Define row models, columns, and virtualization |
| Arrange a form | Grid | Use rows/columns and size constraints rather than absolute coordinates |
| Arrange a short vertical flow | StackPanel | It measures along its stacking axis differently from a bounded Grid |
| Show overflow | ScrollViewer | Avoid nesting around an already scrolling items control |
| Reveal optional details | Expander | Give its header an understandable label |
| Show progress | ProgressBar | Distinguish known progress from an indeterminate wait |
A custom template changes presentation while retaining the control’s behavior. A custom control changes or extends behavior. Prefer the existing control when it already supplies the necessary input, focus, selection, and accessibility model.
Browse the complete control reference or start with layout.
Example: choose controls for a search screen
Section titled “Example: choose controls for a search screen”Use a TextBox for the query, a Button for an explicit Search action, and a ListBox for selectable results. Put the search row above a bounded * row in a Grid. Use a ProgressBar during loading and a TextBlock for empty or error messages.
If every result needs aligned columns, editing, and sorting, consider TreeDataGrid. If each result is a short title and subtitle, keep the simpler list with a data template.
Continue with binding, commands, and collections to connect these controls to the same model.
Show an identity or page through results
Section titled “Show an identity or page through results”- Use PersonPicture for a photo with initials or a placeholder as fallback. Give the adjacent person label meaningful text; an avatar alone is often ambiguous. See the PersonPicture example.
- Use PagerControl when results come in explicit pages. Set
NumberOfPagesand read or bind the zero-basedSelectedPageIndex; load the page data in your model. A PagerControl does not retrieve data. See the PagerControl example. - Use media controls when the content needs playback, explicit camera capture, or live QR detection.