This example allows users to add new items to the LookUpEdit and posts these items to the data source.
-
Use the LookUpEditBase.AddNewButtonPlacement property to display the Add New button.
-
When a user clicks this button or enters a value that does not exist in the data source, the
LookUpEdit
raises the ProcessNewValue event. -
Create an EventToCommand behavior and execute the
ShowProductForm
command when theProcessNewValue
event is raised. -
In the
ShowProductForm
command, use the DialogService to invoke a new item dialog. This dialog contains the DataLayoutControl that allows users to specify the item's properties. -
Add the specified item to the data source if the user clicks the Add button.
- MainWindow.xaml (VB: MainWindow.xaml)
- ViewModel.cs (VB: ViewModel.vb)
- Products.cs (VB: Products.vb)