//bind events public async void Changed(object sender, SelectionChangedEventArgs e) { ListView item = (ListView)sender; if (item.SelectedIndex == -1) { return; } var dialog = new ContentDialog() { Title = "", }; // Setup Content var panel = new StackPanel(); panel.Children.Add(new TextBlock { Text = "Volgende bestemming wilt u wijzigen: " + this.SelectedDestination.Name, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 0, 0, 15) }); var cb = new TextBox { TextWrapping = TextWrapping.Wrap, HorizontalContentAlignment = HorizontalAlignment.Stretch }; panel.Children.Add(cb); dialog.Content = panel; // Add Buttons dialog.PrimaryButtonText = "Ok"; dialog.PrimaryButtonClick += async delegate { string text = cb.Text; Response res = await DestinationRepository.PutDestinationName(this.SelectedDestination.Destinations_ID, text); Loaded(); }; dialog.SecondaryButtonText = "Cancel"; dialog.SecondaryButtonClick += delegate { }; // Show Dialog var result = await dialog.ShowAsync(); if (result == ContentDialogResult.None) { } item.SelectedIndex = -1; }