Back to Devexpress

ASPxNavBar.GroupContentStyle Property

aspnet-devexpress-dot-web-dot-aspxnavbar-e7dcc6fd.md

latest4.8 KB
Original Source

ASPxNavBar.GroupContentStyle Property

Gets the style settings for the client regions of all groups within the navbar control.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public NavBarGroupContentStyle GroupContentStyle { get; }
vb
Public ReadOnly Property GroupContentStyle As NavBarGroupContentStyle

Property Value

TypeDescription
NavBarGroupContentStyle

A NavBarGroupContentStyle object that contains the style settings for the group client regions.

|

Remarks

The GroupContentStyle property provides access to the style settings which define the common appearance style for the client regions of all groups within the navbar control. A group’s client region is considered as an area where group items are displayed - it doesn’t involve the group’s header. The common header style can be defined via the navbar’s ASPxNavBar.GroupHeaderStyle property.

In order to access and change the content style of a particular group within the navbar control, the group’s NavBarGroup.ContentStyle property can be used.

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.

aspx
<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>
csharp
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;
}
vb
Protected Sub ASPxNavBar1_GroupDataBound(ByVal source As Object, ByVal e As NavBarGroupEventArgs)
    Dim hierarchyData As IHierarchyData = (TryCast(e.Group.DataItem, IHierarchyData))
    Dim xmlElement As XmlElement = TryCast(hierarchyData.Item, XmlElement)
    Dim attributes As XmlAttributeCollection = xmlElement.Attributes
    If xmlElement.Attributes("View") IsNot Nothing Then
        e.Group.Text = xmlElement.Attributes("View").Value
    End If
End Sub

See Also

ContentStyle

GroupHeaderStyle

Navigation Bar

ASPxNavBar Class

ASPxNavBar Members

DevExpress.Web Namespace