当前位置: 首页>>代码示例>>C#>>正文


C# FrameworkObject.EndInit方法代码示例

本文整理汇总了C#中MS.Internal.FrameworkObject.EndInit方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkObject.EndInit方法的具体用法?C# FrameworkObject.EndInit怎么用?C# FrameworkObject.EndInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MS.Internal.FrameworkObject的用法示例。


在下文中一共展示了FrameworkObject.EndInit方法的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;

        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:69,代码来源:FrameworkElementFactory.cs


注:本文中的MS.Internal.FrameworkObject.EndInit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。