You can create custom controls and implement custom logic for user interface elements. A good custom control is abstract, self-contained, and recurring.
A Slide Toggle is a good example of a custom control:
The menu bar of your application isn’t a good example of a custom control:
After you have created a custom control, you can style it with USS, add logic to handle events in C#, and expose and use it in UI Builder.
Topic | 描述 |
---|---|
Create custom controls | Understand all aspects of creating and using custom controls. |
Expose custom controls to UXML and UI Builder | Understand how to expose your custom controls and define attributes for your custom controls. |
Customize UXML tag names and attributes | Understand how to customize a UXML tag name, override the default value of a base class attribute, or restrict the accepted attributes for your custom controls. |