📄 navigationnode.cs
字号:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml;
namespace ComponentArt.Web.UI
{
/// <summary>
/// Base navigation node class. Provides core navigation node properties such as Text, NavigateUrl, AutoPostBackOnSelect. All ComponentArt navigation node classes inherit from this class.
/// </summary>
[ToolboxItem(false)]
public abstract class NavigationNode : System.Web.UI.WebControls.WebControl
{
internal bool _defaultStyle = false;
#region Public Properties
#region Unused hidden inheritance
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override string AccessKey
{
get { return base.AccessKey; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override FontInfo Font
{
get { return base.Font; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override System.Drawing.Color BackColor
{
get { return base.BackColor; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override System.Drawing.Color BorderColor
{
get { return base.BorderColor; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override BorderStyle BorderStyle
{
get { return base.BorderStyle; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override Unit BorderWidth
{
get { return base.BorderWidth; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool EnableViewState
{
get { return base.EnableViewState; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override System.Drawing.Color ForeColor
{
get { return base.ForeColor; }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override short TabIndex
{
get
{
return base.TabIndex;
}
}
#endregion
/// <summary>
/// Whether to perform a postback when this node is selected. Default: false.
/// </summary>
[Description("Whether to perform a postback when this node is selected. Default: false.")]
[Category("Behavior")]
[DefaultValue(false)]
public bool AutoPostBackOnSelect
{
get
{
string o = Properties[GetAttributeVarName("AutoPostBackOnSelect")];
return (o == null) ? (navigator == null? false : navigator.AutoPostBackOnSelect) : Utils.ParseBool(o, false);
}
set
{
Properties[GetAttributeVarName("AutoPostBackOnSelect")] = value.ToString();
}
}
/// <summary>
/// Whether to perform validation when this node causes a postback. Default: Inherit.
/// </summary>
[Category("Behavior")]
[Description("Whether to perform validation when this node causes a postback. Default: Inherit.")]
[DefaultValue(InheritBool.Inherit)]
public InheritBool CausesValidation
{
get
{
return Utils.ParseInheritBool(Properties[GetAttributeVarName("CausesValidation")]);
}
set
{
Properties[GetAttributeVarName("CausesValidation")] = value.ToString();
}
}
/// <summary>
/// Client-side command to execute on selection. This can be any valid client script.
/// </summary>
[Category("Behavior")]
[Description("Client-side command to execute on selection.")]
[DefaultValue("")]
public string ClientSideCommand
{
get
{
string o = Properties[GetAttributeVarName("ClientSideCommand")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("ClientSideCommand")] = value;
}
}
/// <summary>
/// ID of the client template to use for this node.
/// </summary>
[Category("Appearance")]
[Description("ID of the client template to use for this node.")]
[DefaultValue("")]
public string ClientTemplateId
{
get
{
string o = Properties[GetAttributeVarName("ClientTemplateId")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("ClientTemplateId")] = value;
}
}
/// <summary>
/// Default CSS class to use for this node.
/// </summary>
[Category("Appearance")]
[Description("Default CSS class to use for this node.")]
[DefaultValue("")]
public new string CssClass
{
get
{
string o = Properties[GetAttributeVarName("CssClass")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("CssClass")] = value;
}
}
/// <summary>
/// Depth within the structure.
/// </summary>
/// <remarks>
/// This is a read-only property.
/// </remarks>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Depth
{
get
{
int depth = 0;
for(NavigationNode oNode = this; oNode.parentNode != null; oNode = oNode.parentNode)
{
depth++;
}
return depth;
}
}
/// <summary>
/// Whether this navigation node is enabled.
/// </summary>
[Category("Behavior")]
[Description("Whether this navigation node is enabled.")]
[DefaultValue(true)]
public override bool Enabled
{
get
{
string o = Properties[GetAttributeVarName("Enabled")];
return (o == null) ? true : Utils.ParseBool(o, true);
}
set
{
Properties[GetAttributeVarName("Enabled")] = value.ToString();
}
}
/// <summary>
/// ID of this node.
/// </summary>
[Description("ID of this node.")]
[DefaultValue("")]
public new string ID
{
get
{
string o = Properties[GetAttributeVarName("ID")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("ID")] = value;
}
}
/// <summary>
/// Whether the selected node is one of this node's descendants.
/// </summary>
/// <remarks>
/// This is a read-only property.
/// </remarks>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsChildSelected
{
get
{
if( this.navigator == null ||
this.navigator.selectedNode == null)
{
return false;
}
else
{
NavigationNode oNode = this.navigator.selectedNode.parentNode;
while(oNode != null)
{
if(oNode == this)
{
return true;
}
oNode = oNode.parentNode;
}
return false;
}
}
}
/// <summary>
/// Whether this is the selected node.
/// </summary>
/// <remarks>
/// This is a read-only property.
/// </remarks>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsSelected
{
get
{
return this.navigator != null? (this.navigator.selectedNode == this) : false;
}
}
/// <summary>
/// String representing keyboard shortcut for selecting this node.
/// </summary>
/// <remarks>
/// Examples of the format are:
/// Shift+Ctrl+P, Alt+A, Shift+Alt+F7, etc. "Shift", "Ctrl" and "Alt" must appear in that order.
/// </remarks>
[Category("Behavior")]
[Description("String representing keyboard shortcut for selecting this node.")]
[DefaultValue("")]
public string KeyboardShortcut
{
get
{
string o = Properties[GetAttributeVarName("KeyboardShortcut")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("KeyboardShortcut")] = value;
}
}
/// <summary>
/// URL to navigate to when this node is selected.
/// </summary>
[Category("Navigation")]
[Description("URL to navigate to when this node is selected.")]
[DefaultValue("")]
public string NavigateUrl
{
get
{
string o = Properties[GetAttributeVarName("NavigateUrl")];
return (o == null) ? string.Empty : (navigator == null? o : navigator.ConvertUrl(o));
}
set
{
Properties[GetAttributeVarName("NavigateUrl")] = value;
}
}
/// <summary>
/// ID of PageView to switch the target ComponentArt MultiPage control to
/// when this node is selected.
/// </summary>
/// <seealso cref="BaseNavigator.MultiPageId" />
[Category("Behavior")]
[Description("ID of PageView to switch the target ComponentArt MultiPage control to when this node is selected.")]
[DefaultValue("")]
public string PageViewId
{
get
{
string o = Properties[GetAttributeVarName("PageViewId")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("PageViewId")] = value;
}
}
/// <summary>
/// ID of NavigationCustomTemplate to use for this node.
/// </summary>
[Category("Appearance")]
[Description("ID of NavigationCustomTemplate to use for this node.")]
[DefaultValue("")]
public string ServerTemplateId
{
get
{
string o = Properties[GetAttributeVarName("ServerTemplateId")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("ServerTemplateId")] = value;
}
}
/// <summary>
/// XML file to load the substructure of this node from.
/// </summary>
[Category("Data")]
[Description("XML file to load the substructure of this node from.")]
[DefaultValue("")]
public string SiteMapXmlFile
{
get
{
string o = Properties[GetAttributeVarName("SiteMapXmlFile")];
return (o == null) ? string.Empty : o;
}
set
{
Properties[GetAttributeVarName("SiteMapXmlFile")] = value;
}
}
/// <summary>
/// Target frame for this node's navigation.
/// </summary>
[Category("Navigation")]
[Description("Target frame for this node's navigation.")]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -