Binding InputPanel with ObservableCollection
In This Topic
Collection binding can be implemented in InputPanel using ObservableCollection which works similar to a regular collection. To bind InputPanel to an ObservableCollection, the ObservableCollection<T> class is used to obtain a collection, which acts as a binding source and then the ItemsSource property gets this collection to bind it to the InputPanel control.
Perform the following steps for data binding using ObservableCollection<T> class:
- Set up the application
- Create a data source for InputPanel
- Bind InputPanel to ObservableCollection
Set up the application
- Create a WPF application.
- Add the InputPanel control to the application and name it 'InPanel'.
Back to Top
Create a data source for InputPanel
- Add a new class, Employee, to the application.
- Add the data generators and fields to the class.
- Add properties to the class using the following code.
- Create a constructor of Employee class and add the following code to it.
- Create a method, GetEmployeeList, of ObservableCollection<T> class using the following code.
Back to Top
Bind InputPanel to ObservableCollection
- Add the following code to bind the InputPanel control with data using the ItemsSource property.
- Press F5 to run the application.
Back to Top