ItemsSource="{Binding Path=imgphoto}" />
My c# code:
public partial class MainWindow : Window
{
ObservableCollection
People = new ObservableCollection();//ObservableCollection People2 = new ObservableCollection();
public MainWindow()
{
InitializeComponent();
dataGrid1.ItemsSource = People;
//dataGrid2.ItemsSource = People2;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
People.Add(new Person());
}
public class Person
{
public string EducationClassName { get; set; }
//public DatePicker DateFrom { get; set; }
public DatePicker DateTo { get; set; }
public string NameOfSchoolOrUniversity { get; set; }
public string Certification { get; set; }
public string GradeObtained { get; set; }
//}
//public class Employee
//{
// public int srno { get; set; }
// public string Document { get; set; }
// public Uri Browse { get; set; }
//}
//private void AddDocumentClick(object sender, RoutedEventArgs e)
//{
// People2.Add(new Employee());
}
private void UploadButton(object sender, RoutedEventArgs e)
{
OpenFileDialog openfiledialog = new OpenFileDialog();
openfiledialog.Multiselect = true;
openfiledialog.Title = "Select a picture";
openfiledialog.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
"JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
"Portable Network Graphic (*.png)|*.png";
if (openfiledialog.ShowDialog() == true)
{
imgphoto.Source = new BitmapImage(new Uri(openfiledialog.FileName));
string path = openfiledialog.FileName.ToString();
foreach (string filename in openfiledialog.FileNames) ;
tb.Text = openfiledialog.FileName;
lbFiles.Items.Add(tb.Text);
//lbFiles.Items.Add(Path.GetFileName(filename));
//.ItemsSource = path;
// textbox1.IsReadOnly.ToString(Path.filename);
}
}
}
}
My project's screen shot:
Please help me..........