ASPxNavBar.EnableAnimation Property
Gets or sets a value that specifies whether a specific animation effect is used when expanding/collapsing groups.
Namespace: DevExpress.Web
Assembly:
DevExpress.Web.v21.2.dll
NuGet Package:
DevExpress.Web
Declaration
[DefaultValue(false)]
public virtual bool EnableAnimation { get; set; }
<DefaultValue(False)>
Public Overridable Property EnableAnimation As Boolean
Property Value
Type |
Default |
Description |
Boolean |
false |
true if a specific animation effect is used; otherwise, false.
|
When the ASPxNavBar.AutoPostBack property is set to false, group expanding/collapsing can be performed with a specific animation effect. Use the EnableAnimation property to control whether this predefined animation effect is available for the navbar control. Note that if the ASPxNavBar.EnableCallBacks property is set to true, the animation effect is not used when a collapsed group is expanded for the first time - via a callback.
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 NavBar with AutoCollapse set to True and when all groups have the same height.
View Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors"
TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar"
TagPrefix="dxnb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Charts.xml" XPath="//Chart" />
<dxnb:ASPxNavBar Width="600px" ClientInstanceName="ASPxNavBarClientControl" ID="ASPxNavBar1" runat="server" DataSourceID="XmlDataSource1" EnableAnimation="True" OnGroupDataBound="ASPxNavBar1_GroupDataBound" AutoCollapse="True" 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" />
</dxnb:ASPxNavBar>
</div>
</form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using DevExpress.Web.ASPxNavBar;
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
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;
}
}
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors"
TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar"
TagPrefix="dxnb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Charts.xml" XPath="//Chart" />
<dxnb:ASPxNavBar Width="600px" ClientInstanceName="ASPxNavBarClientControl" ID="ASPxNavBar1" runat="server" DataSourceID="XmlDataSource1" EnableAnimation="True" OnGroupDataBound="ASPxNavBar1_GroupDataBound" AutoCollapse="True" 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" />
</dxnb:ASPxNavBar>
</div>
</form>
</body>
</html>
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Xml
Imports DevExpress.Web.ASPxNavBar
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
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
End Class
See Also