NavigationItemAttribute Class

Specifies whether a class will have a corresponding item in the navigation control.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
public class NavigationItemAttribute :
    Attribute,
    _Attribute
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Interface, Inherited:=False)>
Public Class NavigationItemAttribute
    Inherits Attribute
    Implements _Attribute

Each application built via the eXpressApp Framework has a navigation control on the main window, by default. This control is a part of the Navigation System. The control represents the ShowNavigationItem Action, and the control's items represent the Action's items. This Action allows end-users to display the required Views on the main window:

NavigationItemAttribute

The Navigation Action's items are added from the Application Model's IModelRootNavigationItems node. This node's items are created either manually via the Model Editor, or in code via the NavigationItem attribute applied to the required business class. The attribute's NavigationItemAttribute.IsNavigationItem property must be set to true.

To specify the navigation item within the navigation control, specify the NavigationItemAttribute.GroupName attribute. By default, an item is added to the default item specified by the NavigationItemAttribute.DefaultGroupName property.

If the NavigationItemAttribute.IsNavigationItem property is set to false, or if this attribute is not applied, the ShowNavigationItem Action item list will not have the corresponding item.

In the example below, the NavigationItem attribute is applied to the TestContact class. As a result, the Test Contact item is added to the specified MyContacts navigation item in the navigation control (see the image above).

[NavigationItem("MyContacts")]
public class TestContact : BaseObject {
   public TestContact(Session session) : base(session) {}
   private string name;
   public string Name {
      get {
         return name;
      }
      set {
         SetPropertyValue("Name", ref name, value);
      }
   }
}

When you need to apply the CreatableItemAttribute and VisibleInReportsAttribute attributes in addition to the NavigationItem attribute, it is easier to apply a single DefaultClassOptionsAttribute attribute.

Inheritance

Object
Attribute
NavigationItemAttribute

See Also