'Avalonia - populate list box and read selected file

I want to create listbox and populate it with values from list. Then read selected value. Trivial thing in WPF, in Avalonia it is a challenge I'm unable to solve it. My current (not working) code:

<ListBox
            Grid.Row="1"
            Items="{Binding ListOfItems.Name}"
            SelectionMode="Single"
            SelectedItem="{Binding SelectedItem}"
            SelectionChanged="OnSelectionChanged">
</ListBox>
public class Item
    {
        public string Name { get; set; } = String.Empty;
        public Enum Type { get; set; }
    }
public class MainWindowViewModel : ViewModelBase
    {
        private Item selectedItem;
        private ObservableCollection<Item> items;
        public ObservableCollection<Item> Items
        {
            get => items;
            set => this.RaiseAndSetIfChanged(ref items, value);
        }
        public Item SelectedItem
        {
            get => selectedItem;
            set => this.RaiseAndSetIfChanged(ref selectedItem, value);
        }

        public void Initialize()
        {
            Items = new ObservableCollection<Item>();
            var temp = Enum.GetValues(typeof(Type)).Cast<Type>().ToList();
            foreach(var item in temp)
            {
                var newObject = new Item
                {
                    Name = Methods.GetDescription(item),
                    Type = item
                };
                Items.Add(newObject);
            }
        }
    }

Nothing appears on the list. Similar code in WPF would work with no issues, so I'm out of ideas.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source