// Token: 0x06007505 RID: 29957 RVA: 0x002177D4 File Offset: 0x002159D4 public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (SystemXmlHelper.IsXmlNode(item)) { if (this._xmlNodeContentTemplate == null) { this._xmlNodeContentTemplate = new DataTemplate(); FrameworkElementFactory frameworkElementFactory = ContentPresenter.CreateTextBlockFactory(); Binding binding = new Binding(); binding.XPath = this._displayMemberPath; binding.StringFormat = this._stringFormat; frameworkElementFactory.SetBinding(TextBlock.TextProperty, binding); this._xmlNodeContentTemplate.VisualTree = frameworkElementFactory; this._xmlNodeContentTemplate.Seal(); } return(this._xmlNodeContentTemplate); } if (this._clrNodeContentTemplate == null) { this._clrNodeContentTemplate = new DataTemplate(); FrameworkElementFactory frameworkElementFactory2 = ContentPresenter.CreateTextBlockFactory(); Binding binding2 = new Binding(); binding2.Path = new PropertyPath(this._displayMemberPath, new object[0]); binding2.StringFormat = this._stringFormat; frameworkElementFactory2.SetBinding(TextBlock.TextProperty, binding2); this._clrNodeContentTemplate.VisualTree = frameworkElementFactory2; this._clrNodeContentTemplate.Seal(); } return(this._clrNodeContentTemplate); }
/// <summary> /// Override this method to return an app specific <seealso cref="DataTemplate"/>. /// </summary> /// <param name="item">The data content</param> /// <param name="container">The container in which the content is to be displayed</param> /// <returns>a app specific template to apply.</returns> public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (SystemXmlHelper.IsXmlNode(item)) { if (_xmlNodeContentTemplate == null) { _xmlNodeContentTemplate = new DataTemplate(); FrameworkElementFactory text = ContentPresenter.CreateTextBlockFactory(); Binding binding = new Binding(); binding.XPath = _displayMemberPath; binding.StringFormat = _stringFormat; text.SetBinding(TextBlock.TextProperty, binding); _xmlNodeContentTemplate.VisualTree = text; _xmlNodeContentTemplate.Seal(); } return(_xmlNodeContentTemplate); } else { if (_clrNodeContentTemplate == null) { _clrNodeContentTemplate = new DataTemplate(); FrameworkElementFactory text = ContentPresenter.CreateTextBlockFactory(); Binding binding = new Binding(); binding.Path = new PropertyPath(_displayMemberPath); binding.StringFormat = _stringFormat; text.SetBinding(TextBlock.TextProperty, binding); _clrNodeContentTemplate.VisualTree = text; _clrNodeContentTemplate.Seal(); } return(_clrNodeContentTemplate); } }