public async void AddStorageValue() { var dlg = new StorageValueDialog() { DataContext = new VAR() { Name = "", StartIndex = 0, Tag = 0, Type = TYPE.SHORT } }; var result = await DialogHost.Show(dlg); if (result is bool r && r == true) { VAR v = dlg.DataContext as VAR; Storage.AddItem(v); } }