跳到主要内容
版本:0.10.x

ItemsControl

In WPF, ItemsControl and derived classes such as ListBox have two separate items properties: Items and ItemsSource. Avalonia however just has a single one: Items which is same as WPF ItemsSource property.

Before

contextMenu.Items.Add(runItem);

After

var list = contextMenu.Items as IList;
list?.Add(runItem);