Skip to main content
Tab

ASPxNavBar.ExpandGroupAction Property

Gets or sets a value that specifies which action forces a group to be expanded/collapsed within a nav bar control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue(ExpandGroupAction.Click)]
public ExpandGroupAction ExpandGroupAction { get; set; }

Property Value

Type Default Description
ExpandGroupAction Click

One of the ExpandGroupAction enumeration values.

Available values:

Name Description
Click

Specifies that a navbar group can be expanded/collapsed by a mouse click.

MouseOver

Specifies that a navbar group can be expanded/collapsed via mouse hover.

Remarks

Use the ExpandGroupAction property to specify the precise client mouse action which will expand/collapse a group within a nav bar control - mouse click (the ExpandGroupAction.Click value) or hovering (the ExpandGroupAction.MouseOver value).

Example

This example demonstrates how to automatically expand a NavBarGroup when the mouse hovers over a group header. This functionality is turned on by setting the ExpandGroupAction property to MouseOver``, and it may be extremely useful for the @DevExpress.Web.ASPxNavBar with @DevExpress.Web.ASPxNavBar.AutoCollapse set toTrue` and when all groups have the same height.

<dx:ASPxNavBar runat="server" DataSourceID="XmlDataSource1" Width="600px"  AutoCollapse="True"
                 ClientInstanceName="ASPxNavBarClientControl" ID="ASPxNavBar1" EnableAnimation="True" 
                 OnGroupDataBound="ASPxNavBar1_GroupDataBound" ExpandGroupAction="MouseOver" 
                 Font-Bold="False" Font-Names="Tahoma" Font-Size="8pt" GroupSpacing="1px">
    <GroupContentTemplate>
        <table border="0" cellpadding="0" cellspacing="0"><tr>
        <td valign="top"><dxe:ASPxImage ID="Image1" runat="server" ImageUrl='<%# Container.EvalDataItem("BigImageUrl") %>' AlternateText='<%# Container.EvalDataItem("View") %>' /></td>
        <td valign="top" style="padding-left: 10px; color: #9D9D9D;"><div class="Hint"><dxe:ASPxLabel ID="Label2" runat="server" Text='<%# Container.EvalDataItem("Description") %>' /></div></td>
        </tr></table>
    </GroupContentTemplate>
    <GroupContentStyle>
        <Paddings Padding="7px" />
        <Border BorderWidth="0px" />
    </GroupContentStyle>
    <GroupHeaderStyle BackColor="#888888" Font-Bold="True" Font-Underline="False" ForeColor="White">
        <Paddings Padding="3px" PaddingLeft="7px" />
        <Border BorderWidth="0px" />
    </GroupHeaderStyle>
    <Paddings Padding="1px" />
    <Border BorderColor="#A8A8A8" BorderStyle="Solid" BorderWidth="1px" />
</dx:ASPxNavBar>
protected void ASPxNavBar1_GroupDataBound(object source, NavBarGroupEventArgs e) {
    IHierarchyData hierarchyData = (e.Group.DataItem as IHierarchyData);
    XmlElement xmlElement = hierarchyData.Item as XmlElement;
    XmlAttributeCollection attributes = xmlElement.Attributes;
    if(xmlElement.Attributes["View"] != null)
        e.Group.Text = xmlElement.Attributes["View"].Value;
}
See Also