|
1 | 1 | <!-- default badges list --> |
2 | | - |
3 | 2 | [](https://supportcenter.devexpress.com/ticket/details/T1002750) |
4 | 3 | [](https://docs.devexpress.com/GeneralInformation/403183) |
5 | 4 | [](#does-this-example-address-your-development-requirementsobjectives) |
6 | 5 | <!-- default badges end --> |
7 | 6 | # XAF - How to show the number of List View items in the Navigation Control |
8 | 7 |
|
9 | | -## Scenario |
10 | | - |
11 | | -In this example, we demonstrate how to show the number of List View items in the Navigation Control. You can add or delete items in List Views. The record count in navigation item captions will be automatically updated. |
| 8 | +This example displays the number of List View items in the Navigation Control. When a user adds or deletes List View items, navigation item captions update the record count automatically. |
12 | 9 |
|
13 | 10 | ### ASP.NET Core Blazor |
14 | 11 |
|
15 | | - |
| 12 | + |
16 | 13 |
|
| 14 | +## Implementation Details |
17 | 15 |
|
| 16 | +Follow the steps below to customize navigation item captions: |
18 | 17 |
|
19 | | -## Implementation Steps |
| 18 | +1. Create a Window Controller ([NavigationObjectCountController.cs](./CS/EFCore/ItemCountEF/ItemCountEF.Module/Controllers/NavigationObjectCountController.cs)). |
| 19 | + * In the [FrameAssigned](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Controller.FrameAssigned) event handler, subscribe to the [NavigationItemCreated](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.SystemModule.ShowNavigationItemController.NavigationItemCreated) event. |
| 20 | + * Use the [NavigationItem](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.SystemModule.NavigationItemCreatedEventArgs.NavigationItem).[Caption](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Actions.ChoiceActionItem.Caption) event argument property to specify the custom caption (add the number of items). |
| 21 | +1. Create a View Controller ([RefreshNavigationController.cs](./CS/EFCore/ItemCountEF/ItemCountEF.Module/Controllers/RefreshNavigationController.cs)). |
| 22 | + * In the [Activated](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Controller.Activated) event handler, subscribe to the [IObjectSpace.Committed](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.IObjectSpace.Committed) event. |
| 23 | + * Call the [RecreateNavigationItems](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.SystemModule.ShowNavigationItemController.RecreateNavigationItems) method to recreate navigation items whenever underlying data changes. |
20 | 24 |
|
21 | | -1. Create a View Controller. In the overridden **OnActivated** method, handle the [IObjectSpace.Committed](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.IObjectSpace.Committed) event. In this event handler, call the [ShowNavigationItemController.RecreateNavigationItems](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.SystemModule.ShowNavigationItemController.RecreateNavigationItems) method to re-create the Navigation System items after saving changes made in the current Grid List editor. |
22 | | -2. Create a Window Controller. Handle the [ShowNavigationItemController.NavigationItemCreated](https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.SystemModule.ShowNavigationItemController.NavigationItemCreated) event in the overridden **OnFrameAssigned** method. In this event handler, specify the item caption via the e.NavigationItem.Caption property. |
| 25 | +## Files to Review |
23 | 26 |
|
24 | | -<!-- default file list --> |
25 | | -*Files to look at*: |
26 | | -* [RefreshNavigationController.cs](./CS/EFCore/ItemCountEF/ItemCountEF.Module/Controllers/RefreshNavigationController.cs) |
27 | 27 | * [NavigationObjectCountController.cs](./CS/EFCore/ItemCountEF/ItemCountEF.Module/Controllers/NavigationObjectCountController.cs) |
28 | | -<!-- default file list end --> |
| 28 | +* [RefreshNavigationController.cs](./CS/EFCore/ItemCountEF/ItemCountEF.Module/Controllers/RefreshNavigationController.cs) |
| 29 | + |
| 30 | +## Documentation |
| 31 | + |
| 32 | +* [Access Controller's Events and Properties](https://docs.devexpress.com/eXpressAppFramework/112676/ui-construction/controllers-and-actions/customize-controllers-and-actions#access-controllers-events-and-properties) |
| 33 | + |
| 34 | +## More Examples |
29 | 35 |
|
30 | | -## See Also |
| 36 | +* [XAF - How to show the number of nested List View items in tab captions](https://github.com/DevExpress-Examples/XAF-How-to-show-the-number-of-nested-list-views-items-in-tab-captions) |
31 | 37 |
|
32 | | -- [Access Controller’s Events and Properties](https://docs.devexpress.com/eXpressAppFramework/112676/concepts/controllers-and-actions/customize-controllers-and-actions#access-controllers-events-and-properties) |
33 | | -- [XAF - How to show the number of nested List View items in tab captions](https://github.com/DevExpress-Examples/XAF-How-to-show-the-number-of-nested-list-views-items-in-tab-captions) |
34 | 38 | <!-- feedback --> |
35 | 39 | ## Does this example address your development requirements/objectives? |
36 | 40 |
|
|
0 commit comments