📄 basemenu.cs
字号:
}
}
private ItemLook _defaultSelectedItemLook;
/// <summary>
/// The default look to apply to the selected item.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ItemLook DefaultSelectedItemLook
{
get
{
if(_defaultSelectedItemLook == null)
{
_defaultSelectedItemLook = new ItemLook(false, true);
}
return _defaultSelectedItemLook;
}
set
{
if(value != null)
{
_defaultSelectedItemLook = (ItemLook)value.Clone();
}
}
}
/// <summary>
/// The ID of the default look to apply to the selected items.
/// </summary>
[Description("The ID of the default look to apply to the selected items.")]
[DefaultValue("")]
[Category("ItemLook")]
public string DefaultSelectedItemLookId
{
get
{
object o = ViewState["DefaultSelectedItemLookId"];
return (o == null) ? string.Empty : (string)o;
}
set
{
ViewState["DefaultSelectedItemLookId"] = value;
}
}
/// <summary>
/// The duration of the expand animation, in milliseconds.
/// </summary>
/// <seealso cref="ExpandSlide" />
/// <seealso cref="ExpandTransition" />
/// <seealso cref="ExpandTransitionCustomFilter" />
[Category("Animation")]
[Description("The duration of the expand animation, in milliseconds.")]
[DefaultValue(200)]
public int ExpandDuration
{
get
{
return Utils.ParseInt(ViewState["ExpandDuration"]);
}
set
{
ViewState["ExpandDuration"] = value;
}
}
/// <summary>
/// The slide type to use for the expand animation.
/// </summary>
/// <seealso cref="ExpandDuration" />
/// <seealso cref="ExpandTransition" />
/// <seealso cref="ExpandTransitionCustomFilter" />
[Category("Animation")]
[Description("The slide type to use for the expand animation.")]
[DefaultValue(SlideType.ExponentialDecelerate)]
public SlideType ExpandSlide
{
get
{
return Utils.ParseSlideType(ViewState["ExpandSlide"]);
}
set
{
ViewState["ExpandSlide"] = value;
}
}
/// <summary>
/// The transition effect to use for the expand animation.
/// </summary>
/// <seealso cref="ExpandSlide" />
/// <seealso cref="ExpandDuration" />
/// <seealso cref="ExpandTransitionCustomFilter" />
[Category("Animation")]
[Description("The transition effect to use for the expand animation.")]
[DefaultValue(TransitionType.None)]
public TransitionType ExpandTransition
{
get
{
return Utils.ParseTransitionType(ViewState["ExpandTransition"]);
}
set
{
ViewState["ExpandTransition"] = value;
}
}
/// <summary>
/// The custom transition filter to use for the expand animation.
/// </summary>
/// <seealso cref="ExpandSlide" />
/// <seealso cref="ExpandDuration" />
/// <seealso cref="ExpandTransition" />
[Category("Animation")]
[Description("The custom transition filter to use for the expand animation.")]
[DefaultValue(null)]
public string ExpandTransitionCustomFilter
{
get
{
return (string)ViewState["ExpandTransitionCustomFilter"];
}
set
{
ViewState["ExpandTransitionCustomFilter"] = value;
}
}
/// <summary>
/// ID of item to forcefully highlight. This will make it appear as it would when selected.
/// </summary>
[Category("Appearance")]
[Description("ID of item to forcefully highlight.")]
[DefaultValue("")]
public string ForceHighlightedItemID
{
get
{
return base.ForceHighlightedNodeID;
}
set
{
base.ForceHighlightedNodeID = value;
}
}
private ItemLookCollection _looks;
/// <summary>
/// The collection of looks defined for this control.
/// </summary>
/// <remarks>
/// The ItemLooks defined in this collection can be referenced by Default look properties on the control using the corresponding LookId
/// property. For example, setting DefaultItemLookId to the LookId of one of the pre-defined ItemLooks will load it into DefaultItemLook.
/// Similarly, Items can reference ItemLooks defined in their parent control.
/// </remarks>
/// <seealso cref="BaseMenuItem.Look" />
[Description("The collection of looks defined for this control.")]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Category("ItemLook")]
public ItemLookCollection ItemLooks
{
get
{
if(_looks == null)
{
_looks = new ItemLookCollection();
}
return _looks;
}
}
/// <summary>
/// ID of item to begin rendering down from.
/// </summary>
[Description("ID of item to begin rendering down from.")]
[DefaultValue("")]
[Category("Data")]
public string RenderRootItemId
{
get
{
return base.RenderRootNodeId;
}
set
{
base.RenderRootNodeId = value;
}
}
/// <summary>
/// Whether to include the RenderRootItem when rendering, instead of only its children. Default: false.
/// </summary>
[Category("Data")]
[Description("Whether to include the RenderRootItem when rendering, instead of only its children. Default: false.")]
[DefaultValue(false)]
public bool RenderRootItemInclude
{
get
{
return base.RenderRootNodeInclude;
}
set
{
base.RenderRootNodeInclude = value;
}
}
#endregion
#region Methods
protected override NavigationNode AddNode()
{
return null;
}
/// <summary>
/// Apply looks to the data: Load specified looks by ID, and apply them.
/// If called explicitly, this method will overwrite some look settings which were set on individual nodes.
/// </summary>
public virtual void ApplyLooks()
{
if(this.DefaultItemLookId != string.Empty)
{
this.DefaultItemLook = this.ItemLooks[this.DefaultItemLookId];
}
if(this.DefaultSelectedItemLookId != string.Empty)
{
this.DefaultSelectedItemLook = this.ItemLooks[this.DefaultSelectedItemLookId];
}
if(this.DefaultChildSelectedItemLookId != string.Empty)
{
this.DefaultChildSelectedItemLook = this.ItemLooks[this.DefaultChildSelectedItemLookId];
}
if(this.DefaultDisabledItemLookId != string.Empty)
{
this.DefaultDisabledItemLook = this.ItemLooks[this.DefaultDisabledItemLookId];
}
if(this.nodes != null && this.nodes.Count > 0)
{
foreach(BaseMenuItem oItem in this.nodes)
{
oItem.navigator = this;
oItem.ApplyLooks();
}
}
}
internal BaseMenuItem FindItemById(string sNodeID)
{
return (BaseMenuItem)base.FindNodeById(sNodeID);
}
private void LoadPreloadImagesRecursive(NavigationNodeCollection arItems)
{
foreach(BaseMenuItem oItem in arItems)
{
string [] arProperties = new string [] {
oItem.EffectiveLook.ImageUrl,
oItem.EffectiveLook.LeftIconUrl,
oItem.EffectiveLook.RightIconUrl,
oItem.EffectiveLook.ActiveImageUrl,
oItem.EffectiveLook.ActiveLeftIconUrl,
oItem.EffectiveLook.ActiveRightIconUrl,
oItem.EffectiveLook.ExpandedImageUrl,
oItem.EffectiveLook.ExpandedLeftIconUrl,
oItem.EffectiveLook.ExpandedRightIconUrl,
oItem.EffectiveLook.HoverImageUrl,
oItem.EffectiveLook.HoverLeftIconUrl,
oItem.EffectiveLook.HoverRightIconUrl};
// if its an image, add to preloadimages
foreach(string sValue in arProperties)
{
if(sValue != null && sValue != string.Empty)
{
string sPreloadImage = ConvertImageUrl(sValue);
// add sValue to menu.preloadimages if not already there
if(!this.PreloadImages.Contains(sPreloadImage))
{
this.PreloadImages.Add(sPreloadImage);
}
}
}
if(oItem.nodes != null)
{
LoadPreloadImagesRecursive(oItem.nodes);
}
}
}
protected virtual void LoadPreloadImages()
{
if(this.nodes != null)
{
this.LoadPreloadImagesRecursive(this.nodes);
}
}
protected override bool IsDownLevel()
{
if (this.ClientTarget == ClientTargetLevel.Downlevel) return true;
if (this.ClientTarget == ClientTargetLevel.Uplevel) return false;
return false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -