private void btnAddPhoto_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Image|*.jpg|*.jpeg|"; openFileDialog1.Title = "Виберете фото"; if (openFileDialog1.ShowDialog() == true) { BitmapImage bi3 = new BitmapImage(); bi3.BeginInit(); bi3.UriSource = new Uri(openFileDialog1.FileName); bi3.EndInit(); ImageS.Source = bi3; student.Image = photo.ImageToByte(photo.BitmapImage2Bitmap(bi3)); control.stud.Save(); } }