SetNamingContainer() private method

private SetNamingContainer ( Control nc ) : void
nc Control
return void
コード例 #1
0
ファイル: Control.cs プロジェクト: stabbylambda/mono
		protected internal virtual void AddedControl (Control control, int index)
		{
			ResetControlsCache ();

			/* Ensure the control don't have more than 1 parent */
			if (control._parent != null)
				control._parent.Controls.Remove (control);

			control._parent = this;
			Control nc = ((stateMask & IS_NAMING_CONTAINER) != 0) ? this : NamingContainer;

			if ((stateMask & (INITING | INITED)) != 0) {
				control.InitRecursive (nc);
				control.SetMask (REMOVED, false);
			} else {
				control.SetNamingContainer (nc);
				control.SetMask (REMOVED, false);
				return;
			}

			if ((stateMask & (VIEWSTATE_LOADED | LOADED)) != 0) {
				if (pendingVS != null) {
					object vs;
					bool byId = LoadViewStateByID;
					string id;
					
					if (byId) {
						control.EnsureID ();
						id = control.ID;
						vs = pendingVS [id];
					} else {
						id = null;
						vs = pendingVS [index];
					}
					
					if (vs != null) {
						if (byId)
							pendingVS.Remove (id);
						else
							pendingVS.Remove (index);
						
						if (pendingVS.Count == 0)
							pendingVS = null;

						control.LoadViewStateRecursive (vs);
					}
				}
			}

			if ((stateMask & LOADED) != 0)
				control.LoadRecursive ();

			if ((stateMask & PRERENDERED) != 0)
				control.PreRenderRecursiveInternal ();
		}