private void AddLink() { //http://msdn.microsoft.com/en-us/library/aa969773(v=vs.85).aspx EditHyperlink editHyperlink = new EditHyperlink(); editHyperlink.Owner = this; editHyperlink.CurrentHyperlink = new HyperlinkItem(); editHyperlink.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; bool?result = editHyperlink.ShowDialog(); if (result.HasValue && result.Value) { hyperlinkInterface.AddHyperlink(editHyperlink.CurrentHyperlink); this.listBox.ItemsSource = hyperlinkInterface.HyperlinkList; this.listBox.SelectedItem = hyperlinkInterface.SelectedHyperlink; this.listBox.ScrollIntoView(this.listBox.SelectedItem); } }
private void EditLink() { if (listBox.SelectedItem != null) { EditHyperlink editHyperlink = new EditHyperlink(); //editHyperlink.Owner = Application.Current.MainWindow; editHyperlink.Owner = this; editHyperlink.CurrentHyperlink = listBox.SelectedItem as HyperlinkItem; editHyperlink.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; bool?result = editHyperlink.ShowDialog(); if (result.HasValue && result.Value) { //hyperlinkInterface.AddHyperlink(editHyperlink.CurrentHyperlink); hyperlinkInterface.UpdateHyperlink(editHyperlink.CurrentHyperlink); this.listBox.ItemsSource = hyperlinkInterface.HyperlinkList; this.listBox.SelectedItem = hyperlinkInterface.SelectedHyperlink; this.listBox.ScrollIntoView(this.listBox.SelectedItem); } } }