In WPF, when deriving a control from a base control, you add this in the constructor.
DefaultStyleKeyProperty.OverrideMetadata(typeof(MediaPlayer), new StyledPropertyMetadata(typeof(MediaPlayer)));
How do you convert this to Avalonia UI?
Implement IStyleable
interface and set StyleKey
to your type.
public class MyGrid : Grid, IStyleable
{
Type IStyleable.StyleKey => typeof(MyGrid);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.