• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Windows.FrameworkTemplate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.FrameworkTemplate的典型用法代码示例。如果您正苦于以下问题:C# FrameworkTemplate类的具体用法?C# FrameworkTemplate怎么用?C# FrameworkTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FrameworkTemplate类属于System.Windows命名空间,在下文中一共展示了FrameworkTemplate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EvaluateOldNewStates

        // Given a multi data trigger and associated context information,
        //  evaluate the old and new states of the trigger.

        // The short-circuit logic of multi property trigger applies here too.
        //  we bail if any of the "other" conditions evaluate to false.
        private static void EvaluateOldNewStates( MultiDataTrigger multiDataTrigger,
            DependencyObject triggerContainer,
            BindingBase binding, BindingValueChangedEventArgs changedArgs, UncommonField<HybridDictionary[]> dataField,
            Style style, FrameworkTemplate frameworkTemplate,
            out bool oldState, out bool newState )
        {
            BindingBase evaluationBinding = null;
            object  evaluationValue = null;
            TriggerCondition[] conditions = multiDataTrigger.TriggerConditions;

            // Set up the default condition: A trigger with no conditions will never evaluate to true.
            oldState = false;
            newState = false;

            for( int i = 0; i < multiDataTrigger.Conditions.Count; i++ )
            {
                evaluationBinding = conditions[i].Binding;

                Debug.Assert( evaluationBinding != null,
                    "A null binding was encountered in a MultiDataTrigger conditions collection - this is invalid input and should have been caught earlier.");

                if( evaluationBinding == binding )
                {
                    // The binding that changed belonged to the current condition.
                    oldState = conditions[i].ConvertAndMatch(changedArgs.OldValue);
                    newState = conditions[i].ConvertAndMatch(changedArgs.NewValue);

                    if( oldState == newState )
                    {
                        // There couldn't possibly be a transition here, abort.  The
                        //  returned values here aren't necessarily the state of the
                        //  triggers, but we only care about a transition today.  If
                        //  we care about actual values, we'll need to continue evaluation.
                        return;
                    }
                }
                else
                {
                    evaluationValue = GetDataTriggerValue(dataField, triggerContainer, evaluationBinding);
                    if( !conditions[i].ConvertAndMatch(evaluationValue) )
                    {
                        // A condition other than the one changed has evaluated to false.
                        // There couldn't possibly be a transition here, short-circuit and abort.
                        oldState = false;
                        newState = false;
                        return;
                    }
                }
            }

            // We should only get this far only if the binding change causes
            //  a true->false (or vice versa) transition in one of the conditions,
            // AND that every other condition evaluated to true.
            return;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:StyleHelper.cs


示例2: XamlContext

		internal XamlContext (XamlContext parent, List<DependencyObject> resources, FrameworkTemplate template)
		{
			Parent = parent;
			Resources = resources;
			Template = template;

			//
			// Its just not worth the lookup time to try accessing these on the parents, so copy them over.
			//
			DefaultXmlns = parent.DefaultXmlns;
			IgnorableXmlns = new List<string> (parent.IgnorableXmlns);
			Xmlns = new Dictionary<string,string> (parent.Xmlns);
		}
开发者ID:kangaroo,项目名称:moon,代码行数:13,代码来源:XamlContext.cs


示例3: TemplateNameScope

        internal TemplateNameScope(
                                    DependencyObject templatedParent,
                                    List<DependencyObject> affectedChildren,
                                    FrameworkTemplate frameworkTemplate )
        {
            Debug.Assert(templatedParent == null || (templatedParent is FrameworkElement || templatedParent is FrameworkContentElement),
                         "Templates are only supported on FE/FCE containers.");

            _affectedChildren = affectedChildren;

            _frameworkTemplate = frameworkTemplate;

            _templatedParent = templatedParent;

            _isTemplatedParentAnFE = true;

        }
开发者ID:JianwenSun,项目名称:cc,代码行数:17,代码来源:TemplateNameScope.cs


示例4: Dump

 void Dump(FrameworkTemplate template)
 {
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent = true;
     settings.IndentChars = new string(' ', 4);
     settings.NewLineOnAttributes = true;
     StringBuilder strBuild = new StringBuilder();
     XmlWriter xmlWrite = XmlWriter.Create(strBuild, settings);
     try
     {
         XamlWriter.Save(template, xmlWrite);
         txtBox.Text = strBuild.ToString();
     }
     catch (Exception e)
     {
         txtBox.Text = e.Message;
     }
 }
开发者ID:powernick,项目名称:CodeLib,代码行数:18,代码来源:MainWindow.xaml.cs


示例5: ShowTemplate

    void ShowTemplate(System.Windows.Forms.WebBrowser browser, FrameworkTemplate template) {
      if( template == null ) {
        browser.DocumentText = "(no template)";
        return;
      }

      // Write the template to a file so that the browser knows to show it as XML
      string filename = System.IO.Path.GetTempFileName();
      File.Delete(filename);
      filename = System.IO.Path.ChangeExtension(filename, "xml");

      // pretty print the XAML (for View Source)
      using( XmlTextWriter writer = new XmlTextWriter(filename, System.Text.Encoding.UTF8) ) {
        writer.Formatting = Formatting.Indented;
        XamlWriter.Save(template, writer);
      }

      // Show the template
      browser.Navigate(new Uri(@"file:///" + filename));
    }
开发者ID:ssickles,项目名称:archive,代码行数:20,代码来源:Window1.xaml.cs


示例6: OnTemplateChangedInternal

        internal override void OnTemplateChangedInternal(FrameworkTemplate oldTemplate, FrameworkTemplate newTemplate)
        {
            // Invalidate template references
            _toolBarPanel = null;
            _toolBarOverflowPanel = null;

            base.OnTemplateChangedInternal(oldTemplate, newTemplate);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:ToolBar.cs


示例7: InvokeApplicableDataTriggerActions

        // Given a Style/Template and a Binding whose value has changed, look for
        //  any data triggers that have trigger actions (EnterAction/ExitAction)
        //  and see if any of those actions need to run as a response to this change.
        private static void InvokeApplicableDataTriggerActions(
            Style                               style,
            FrameworkTemplate                   frameworkTemplate,
            DependencyObject                    container,
            BindingBase                         binding,
            BindingValueChangedEventArgs        e,
            UncommonField<HybridDictionary[]>   dataField)
        {
            HybridDictionary dataTriggersWithActions;

            if( style != null )
            {
                dataTriggersWithActions = style.DataTriggersWithActions;
            }
            else if( frameworkTemplate != null )
            {
                dataTriggersWithActions = frameworkTemplate.DataTriggersWithActions;
            }
            else
            {
                dataTriggersWithActions = null;
            }

            if( dataTriggersWithActions != null )
            {
                object candidateTrigger = dataTriggersWithActions[binding];

                if( candidateTrigger != null )
                {
                    // One or more trigger objects need to be evaluated.  The candidateTrigger
                    //  object may be a single trigger or a collection of them.
                    TriggerBase triggerBase = candidateTrigger as TriggerBase;
                    if( triggerBase != null )
                    {
                        InvokeDataTriggerActions( triggerBase, container, binding, e,
                            style, frameworkTemplate, dataField);
                    }
                    else
                    {
                        Debug.Assert(candidateTrigger is List<TriggerBase>, "Internal data structure error: The HybridDictionary [Style/Template].DataTriggersWithActions " +
                            "is expected to hold a single TriggerBase or a List<T> of them.  An object of type " +
                            candidateTrigger.GetType().ToString() + " is not expected.  Where did this object come from?");

                        List<TriggerBase> triggerList = (List<TriggerBase>)candidateTrigger;

                        for( int i = 0; i < triggerList.Count; i++ )
                        {
                            InvokeDataTriggerActions( triggerList[i], container, binding, e,
                                style, frameworkTemplate, dataField);
                        }
                    }
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:57,代码来源:StyleHelper.cs


示例8: UpdateTemplateCache

 internal static void UpdateTemplateCache(ContentPresenter contentPresenter, FrameworkTemplate frameworkTemplate1, FrameworkTemplate frameworkTemplate2, DependencyProperty dependencyProperty)
 {
     // throw new NotImplementedException();
 }
开发者ID:evnik,项目名称:UIFramework,代码行数:4,代码来源:StyleHelper.cs


示例9: OnTemplateChangedInternal

 // Internal helper so FrameworkElement could see call the template changed virtual
 internal override void OnTemplateChangedInternal(FrameworkTemplate oldTemplate, FrameworkTemplate newTemplate)
 {
     OnTemplateChanged((ControlTemplate)oldTemplate, (ControlTemplate)newTemplate);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:Control.cs


示例10: Invoke

 /// <summary>
 /// Invoke the SoundPlayer action.
 /// </summary>
 internal sealed override void Invoke(FrameworkElement el,
                                      FrameworkContentElement ctntEl,
                                      Style targetStyle,
                                      FrameworkTemplate targetTemplate,
                                      Int64 layer)
 {
     PlayWhenLoaded();
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:SoundPlayerAction.cs


示例11: Invoke

 /// <summary>
 ///     Called when all conditions have been satisfied for this action to be
 /// invoked.  (Conditions are not described on this TriggerAction object,
 /// but on the Trigger object holding it.)
 /// </summary>
 /// <remarks>
 ///     This variant is called when the Trigger lives in a Style, and
 /// hence given a reference to its corresponding Style object.
 /// </remarks>
 internal abstract void Invoke( FrameworkElement fe,
                               FrameworkContentElement fce,
                               Style targetStyle,
                               FrameworkTemplate targetTemplate,
                               Int64 layer);
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:TriggerAction.cs


示例12: CreateXamlContext

		private XamlContext CreateXamlContext (FrameworkTemplate template)
		{
			return new XamlContext (Context, TopElement, CreateResourcesList (), template, reader);
		}
开发者ID:dfr0,项目名称:moon,代码行数:4,代码来源:XamlParser.cs


示例13: XamlContext

		internal XamlContext (XamlContext parent, List<DependencyObject> resources, FrameworkTemplate template)
		{
			Parent = parent;
			Resources = resources;
			Template = template;
		}
开发者ID:shana,项目名称:moon,代码行数:6,代码来源:XamlContext.cs


示例14: XamlContext

		internal XamlContext (XamlContext parent, object top_element,
							List<DependencyObject> resources,
							FrameworkTemplate template, XamlNode node)
		{
			Parent = parent;
			TopElement = top_element;
			Resources = resources;
			Template = template;
			Node = node;

			//
			// Its just not worth the lookup time to try accessing these on the parents, so copy them over.
			//
			XmlnsCachedTypes = new Dictionary<XmlNsKey, Type>();
		}
开发者ID:dfr0,项目名称:moon,代码行数:15,代码来源:XamlContext.cs


示例15: ProcessTemplateTriggers

        //
        //  This method
        //  1. Adds shared table entries for property values set via Triggers
        //
        private static void ProcessTemplateTriggers(
            TriggerCollection                                           triggers,
            FrameworkTemplate                                           frameworkTemplate,
            ref FrugalStructList<ChildRecord>                           childRecordFromChildIndex,
            ref FrugalStructList<ItemStructMap<TriggerSourceRecord>>    triggerSourceRecordFromChildIndex,
            ref FrugalStructList<ContainerDependent>                    containerDependents,
            ref FrugalStructList<ChildPropertyDependent>                resourceDependents,
            ref ItemStructList<ChildEventDependent>                     eventDependents,
            ref HybridDictionary                                        dataTriggerRecordFromBinding,
            HybridDictionary                                            childIndexFromChildID,
            ref bool                                                    hasInstanceValues,
            ref HybridDictionary                                        triggerActions,
            FrameworkElementFactory                                     templateRoot,
            ref EventHandlersStore                                      eventHandlersStore,
            ref FrugalMap                                               propertyTriggersWithActions,
            ref HybridDictionary                                        dataTriggersWithActions,
            ref bool                                                    hasLoadedChangeHandler)
        {
            if (triggers != null)
            {
                int triggerCount = triggers.Count;
                for (int i = 0; i < triggerCount; i++)
                {
                    TriggerBase triggerBase = triggers[i];

                    Trigger trigger;
                    MultiTrigger multiTrigger;
                    DataTrigger dataTrigger;
                    MultiDataTrigger multiDataTrigger;
                    EventTrigger eventTrigger;

                    DetermineTriggerType( triggerBase, out trigger, out multiTrigger, out dataTrigger, out multiDataTrigger, out eventTrigger );

                    if ( trigger != null || multiTrigger != null||
                        dataTrigger != null || multiDataTrigger != null )
                    {
                        // Update the SourceChildIndex for each of the conditions for this trigger
                        TriggerCondition[] conditions = triggerBase.TriggerConditions;
                        for (int k=0; k<conditions.Length; k++)
                        {
                            conditions[k].SourceChildIndex = StyleHelper.QueryChildIndexFromChildName(conditions[k].SourceName, childIndexFromChildID);
                        }

                        // Set things up to handle Setter values
                        for (int j = 0; j < triggerBase.PropertyValues.Count; j++)
                        {
                            PropertyValue propertyValue = triggerBase.PropertyValues[j];

                            // Check for trigger rules that act on template children
                            if (propertyValue.ChildName == StyleHelper.SelfName)
                            {
                                // "Self" (container) trigger

                                // Track properties on the container that are being driven by
                                // the Template so that they can be invalidated during Template changes
                                StyleHelper.AddContainerDependent(propertyValue.Property, true /*fromVisualTrigger*/, ref containerDependents);
                            }

                            StyleHelper.UpdateTables(ref propertyValue, ref childRecordFromChildIndex,
                                ref triggerSourceRecordFromChildIndex, ref resourceDependents, ref dataTriggerRecordFromBinding,
                                childIndexFromChildID, ref hasInstanceValues);
                        }

                        // Set things up to handle TriggerActions
                        if( triggerBase.HasEnterActions || triggerBase.HasExitActions )
                        {
                            if( trigger != null )
                            {
                                StyleHelper.AddPropertyTriggerWithAction( triggerBase, trigger.Property, ref propertyTriggersWithActions );
                            }
                            else if( multiTrigger != null )
                            {
                                for( int k = 0; k < multiTrigger.Conditions.Count; k++ )
                                {
                                    Condition triggerCondition = multiTrigger.Conditions[k];

                                    StyleHelper.AddPropertyTriggerWithAction( triggerBase, triggerCondition.Property, ref propertyTriggersWithActions );
                                }
                            }
                            else if( dataTrigger != null )
                            {
                                StyleHelper.AddDataTriggerWithAction( triggerBase, dataTrigger.Binding, ref dataTriggersWithActions );
                            }
                            else if( multiDataTrigger != null )
                            {
                                for( int k = 0; k < multiDataTrigger.Conditions.Count; k++ )
                                {
                                    Condition dataCondition = multiDataTrigger.Conditions[k];

                                    StyleHelper.AddDataTriggerWithAction( triggerBase, dataCondition.Binding, ref dataTriggersWithActions );
                                }
                            }
                            else
                            {
                                throw new InvalidOperationException(SR.Get(SRID.UnsupportedTriggerInTemplate, triggerBase.GetType().Name));
                            }
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:StyleHelper.cs


示例16: FindNameInTemplateContent

        //+------------------------------------------------------------------------------------
        //
        //  FindNameInTemplateContent
        //
        //  Find the object in the template content with the specified name.  This looks
        //  both for children both that are optimized FE/FCE tyes, or any other type.
        //
        //+------------------------------------------------------------------------------------

        internal static Object FindNameInTemplateContent(
            DependencyObject    container,
            string              childName,
            FrameworkTemplate   frameworkTemplate)
        {
            Debug.Assert(frameworkTemplate != null );

            // First, look in the list of optimized FE/FCEs in this template for this name.

            int index;
            Debug.Assert(frameworkTemplate != null);
            index = StyleHelper.QueryChildIndexFromChildName(childName, frameworkTemplate.ChildIndexFromChildName);

            // Did we find it?
            if (index == -1)
            {
                // No, we didn't find it, look at the rest of the named elements in the template content.

                Hashtable hashtable = TemplatedNonFeChildrenField.GetValue(container);
                if( hashtable != null )
                {
                    return hashtable[childName];
                }

                return null;
            }
            else
            {
                // Yes, we found the FE/FCE, return it.

                return StyleHelper.GetChild(container, index);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:42,代码来源:StyleHelper.cs


示例17: CreateChildIndexFromChildName

        //  ===========================================================================
        //  These methods read some of per-instane Style/Template data
        //  ===========================================================================

        #region ReadInstanceData

        //
        //  This method
        //  1. Creates the ChildIndex for the given ChildName. If there is an
        //     existing childIndex it throws an exception for a duplicate name
        //
        internal static int CreateChildIndexFromChildName(
            string              childName,
            FrameworkTemplate   frameworkTemplate)
        {
            Debug.Assert(frameworkTemplate != null );

            // Lock must be made by caller

            HybridDictionary childIndexFromChildName;
            int lastChildIndex;

            Debug.Assert(frameworkTemplate != null);

            childIndexFromChildName = frameworkTemplate.ChildIndexFromChildName;
            lastChildIndex = frameworkTemplate.LastChildIndex;

            if (childIndexFromChildName.Contains(childName))
            {
                throw new ArgumentException(SR.Get(SRID.NameScopeDuplicateNamesNotAllowed, childName));
            }

            // Normal templated child check
            // If we're about to give out an index that we can't support, throw.
            if (lastChildIndex >= 0xFFFF)
            {
                throw new InvalidOperationException(SR.Get(SRID.StyleHasTooManyElements));
            }

            // No index found, allocate
            object value = lastChildIndex;

            childIndexFromChildName[childName] = value;

            Interlocked.Increment(ref lastChildIndex);

            Debug.Assert(frameworkTemplate != null);
            frameworkTemplate.LastChildIndex = lastChildIndex;

            return (int)value;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:51,代码来源:StyleHelper.cs


示例18: Seal

        // Seal this FEF
        internal void Seal(FrameworkTemplate ownerTemplate)
        {
            if (_sealed)
            {
                return;
            }

            // Store owner Template
            _frameworkTemplate = ownerTemplate;

            // Perform actual Seal operation
            Seal();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:FrameworkElementFactory.cs


示例19: GetHeaderFooterVisualFromDataTemplate

        private ContainerVisual GetHeaderFooterVisualFromDataTemplate(FrameworkTemplate template, Rect container)
        {
            if (template == null)
            {
                return null;
            }

            var doc = Source as PrintableDocument;

            var content = template.LoadContent() as FrameworkElement;
            content.DataContext = doc.DataContext;

            var width = _definition.PageSize.Width - _definition.Margins.Left - _definition.Margins.Right;

            content.Measure(_definition.PageSize);
            content.Arrange(new Rect(container.X, container.Y, width, content.DesiredSize.Height));
            content.UpdateLayout();

            var visual = new ContainerVisual();

            visual.Children.Add(content);

            return visual;
        }
开发者ID:rodrigovedovato,项目名称:FlowDocumentReporting,代码行数:24,代码来源:DocumentPaginatorWrapper.cs


示例20: CreateXamlContext

		private XamlContext CreateXamlContext (FrameworkTemplate template)
		{
			return new XamlContext (Context, CreateResourcesList (), template);
		}
开发者ID:shana,项目名称:moon,代码行数:4,代码来源:XamlParser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Windows.Freezable类代码示例发布时间:2022-05-26
下一篇:
C# Windows.FrameworkPropertyMetadata类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap