Advertisement
jovanovski

КИ Лаб3 C#

Mar 9th, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace Lab3
  17. {
  18.     /// <summary>
  19.     /// Interaction logic for MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         public MainWindow()
  24.         {
  25.             InitializeComponent();
  26.             List<Product> list = Data.GetProducts();
  27.             lstBox.ItemsSource = list;
  28.         }
  29.  
  30.         private void btn1_Click(object sender, RoutedEventArgs e)
  31.         {
  32.  
  33.             if (lstBox.SelectedIndex == -1)
  34.             {
  35.             MessageBox.Show("You must select an item!", "Error");
  36.             return;
  37.             }
  38.  
  39.             var newWindow = new Details()
  40.             {
  41.             DataContext = lstBox.SelectedItem as Product
  42.             };
  43.  
  44.            
  45.             newWindow.Show();
  46.  
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement