ItemAdded
This rule is triggered when a new item is created, after it has been added to the end of the datasource. This can be done :
- by a user clicking on an
Addbutton. - by code when calling
AddNewAsync,AddAsync,InsertNewAsyncorInsertAsync
When the rule is triggered, the Datasource property already contains the newly added item.
Note
Since the item is added to the datasource when this rule is triggered, changing the value of its properties will trigger associated PropertyChanged rules.
See this article for more information on event rules execution order.
Arguments
The Arguments property provides the following options.
| Name | Type | Description |
|---|---|---|
Item |
The type of the UI view model | Instance of the item added to the datasource. |
Item versus DatasourceCurrent
Item refers to the item that has been added. It is the same as using Arguments.Item.
Important
Although the current position is usually automatically changed to the one of the last item added, never assume that DatasourceCurrent refers to the added item.
This is because it is possible to add multiple items at once and because the position change can be canceled in a PositionChanging event rule.
To know more on the difference between the Item and DatasourceCurrent properties in an UI view event rule, you can check this article.