本文整理汇总了C#中MS.Internal.FrameworkObject.BeginInit方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkObject.BeginInit方法的具体用法?C# FrameworkObject.BeginInit怎么用?C# FrameworkObject.BeginInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS.Internal.FrameworkObject
的用法示例。
在下文中一共展示了FrameworkObject.BeginInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstantiateUnoptimizedTree
// This tree is used to instantiate a tree, represented by this factory.
// It is instantiated as a normal tree without any template optimizations.
// This is used by designers to inspect a template.
internal FrameworkObject InstantiateUnoptimizedTree()
{
if (!_sealed)
{
throw new InvalidOperationException(SR.Get(SRID.FrameworkElementFactoryMustBeSealed));
}
// Create the object.
FrameworkObject frameworkObject = new FrameworkObject(CreateDependencyObject());
// Mark the beginning of initialization
frameworkObject.BeginInit();
// Set values for this object, taking them from the shared values table.
ProvideValueServiceProvider provideValueServiceProvider = null;
FrameworkTemplate.SetTemplateParentValues( Name, frameworkObject.DO, _frameworkTemplate, ref provideValueServiceProvider );
// Get the first child
FrameworkElementFactory childFactory = _firstChild;
// If we have children, get this object's IAddChild, because it's going to be a parent.
IAddChild iAddChild = null;
if( childFactory != null )
{
iAddChild = frameworkObject.DO as IAddChild;
if (iAddChild == null)
{
throw new InvalidOperationException(SR.Get(SRID.TypeMustImplementIAddChild,
frameworkObject.DO.GetType().Name));
}
}
// Build the children.
while (childFactory != null)
{
if (childFactory._text != null)
{
iAddChild.AddText(childFactory._text);
}
else
{
// Use frameworkObject's IAddChild to add this node.
FrameworkObject childFrameworkObject = childFactory.InstantiateUnoptimizedTree();
AddNodeToParent(frameworkObject.DO, childFrameworkObject );
}
childFactory = childFactory._nextSibling;
}
// Mark the end of the initialization phase
frameworkObject.EndInit();
return frameworkObject;
}