Ejemplo n.º 1
0
        /// <summary>
        ///     This method is invoked when the ContentTemplateSelector property changes.
        /// </summary>
        /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
        /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
        protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
        {
            Helper.CheckTemplateAndTemplateSelector("Content", ContentTemplateProperty, ContentTemplateSelectorProperty, this);

            // if ContentTemplateSelector is really changing (and in use), remove the old template
            this.Template = null;
        }
Ejemplo n.º 2
0
        //------------------------------------------------------
        //
        //  Internal methods
        //
        //------------------------------------------------------

        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareContentPresenter(object item,
                                              DataTemplate itemTemplate,
                                              DataTemplateSelector itemTemplateSelector,
                                              string stringFormat)
        {
            if (item != this)
            {
                // copy templates from parent ItemsControl
                if (_contentIsItem || !HasNonDefaultValue(ContentProperty))
                {
                    Content        = item;
                    _contentIsItem = true;
                }
                if (itemTemplate != null)
                {
                    SetValue(ContentTemplateProperty, itemTemplate);
                }
                if (itemTemplateSelector != null)
                {
                    SetValue(ContentTemplateSelectorProperty, itemTemplateSelector);
                }
                if (stringFormat != null)
                {
                    SetValue(ContentStringFormatProperty, stringFormat);
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>Called when the <see cref="P:System.Windows.Controls.TabControl.ContentTemplateSelector" /> property changes. </summary>
 /// <param name="oldContentTemplateSelector">Old value of the content template selector.</param>
 /// <param name="newContentTemplateSelector">New value of the content template selector.</param>
 // Token: 0x060056DF RID: 22239 RVA: 0x00180790 File Offset: 0x0017E990
 protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
 {
     base.OnContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector);
     if (this.IsSelected)
     {
         TabControl tabControlParent = this.TabControlParent;
         if (tabControlParent != null)
         {
             tabControlParent.SelectedContentTemplateSelector = newContentTemplateSelector;
         }
     }
 }
        public static object CreateView(IViewLocator viewLocator, string documentType, DataTemplate viewTemplate = null, DataTemplateSelector viewTemplateSelector = null) {
            if(viewTemplate != null || viewTemplateSelector != null) {
                var presenter = new ContentPresenter() {
                    ContentTemplate = viewTemplate,
#if !SILVERLIGHT
                    ContentTemplateSelector = viewTemplateSelector
#endif
                };
                return presenter;
            }
            IViewLocator actualLocator = viewLocator ?? (ViewLocator.Default ?? ViewLocator.Instance);
            return actualLocator.ResolveView(documentType);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     This method is invoked when the ContentTemplateSelector property changes.
        /// </summary>
        /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
        /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
        protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
        {
            base.OnContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector);

            // If this is the selected TabItem then we should update TabControl.SelectedContentTemplateSelector
            if (IsSelected)
            {
                TabControl tabControl = TabControlParent;
                if (tabControl != null)
                {
                    tabControl.SelectedContentTemplateSelector = newContentTemplateSelector;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareHeaderedContentControl(object item,
                                                    DataTemplate itemTemplate,
                                                    DataTemplateSelector itemTemplateSelector,
                                                    string stringFormat)
        {
            if (item != this)
            {
                // don't treat Content as a logical child
                ContentIsNotLogical = true;
                HeaderIsNotLogical  = true;

                if (ContentIsItem || !HasNonDefaultValue(ContentProperty))
                {
                    Content       = item;
                    ContentIsItem = true;
                }

                // Visuals can't be placed in both Header and Content, but data can
                if (!(item is Visual) && (HeaderIsItem || !HasNonDefaultValue(HeaderProperty)))
                {
                    Header       = item;
                    HeaderIsItem = true;
                }

                if (itemTemplate != null)
                {
                    SetValue(HeaderTemplateProperty, itemTemplate);
                }
                if (itemTemplateSelector != null)
                {
                    SetValue(HeaderTemplateSelectorProperty, itemTemplateSelector);
                }
                if (stringFormat != null)
                {
                    SetValue(HeaderStringFormatProperty, stringFormat);
                }
            }
            else
            {
                ContentIsNotLogical = false;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareHeaderedItemsControl(object item, ItemsControl parentItemsControl)
        {
            bool headerIsNotLogical = item != this;

            // don't treat Header as a logical child
            WriteControlFlag(ControlBoolFlags.HeaderIsNotLogical, headerIsNotLogical);

            // copy styles from parent ItemsControl
            PrepareItemsControl(item, parentItemsControl);

            if (headerIsNotLogical)
            {
                if (HeaderIsItem || !HasNonDefaultValue(HeaderProperty))
                {
                    Header       = item;
                    HeaderIsItem = true;
                }

                DataTemplate         itemTemplate         = parentItemsControl.ItemTemplate;
                DataTemplateSelector itemTemplateSelector = parentItemsControl.ItemTemplateSelector;
                string itemStringFormat = parentItemsControl.ItemStringFormat;

                if (itemTemplate != null)
                {
                    SetValue(HeaderTemplateProperty, itemTemplate);
                }
                if (itemTemplateSelector != null)
                {
                    SetValue(HeaderTemplateSelectorProperty, itemTemplateSelector);
                }
                if (itemStringFormat != null &&
                    Helper.HasDefaultValue(this, HeaderStringFormatProperty))
                {
                    SetValue(HeaderStringFormatProperty, itemStringFormat);
                }

                PrepareHierarchy(item, parentItemsControl);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 ///     This method is invoked when the ContentTemplateSelector property changes.
 /// </summary>
 /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
 /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
 protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
 {
     Helper.CheckTemplateAndTemplateSelector("Content", ContentTemplateProperty, ContentTemplateSelectorProperty, this);
 }
        // Token: 0x06004E5D RID: 20061 RVA: 0x00160980 File Offset: 0x0015EB80
        private void PrepareHierarchy(object item, ItemsControl parentItemsControl)
        {
            DataTemplate dataTemplate = this.HeaderTemplate;

            if (dataTemplate == null)
            {
                DataTemplateSelector headerTemplateSelector = this.HeaderTemplateSelector;
                if (headerTemplateSelector != null)
                {
                    dataTemplate = headerTemplateSelector.SelectTemplate(item, this);
                }
                if (dataTemplate == null)
                {
                    dataTemplate = (DataTemplate)FrameworkElement.FindTemplateResourceInternal(this, item, typeof(DataTemplate));
                }
            }
            HierarchicalDataTemplate hierarchicalDataTemplate = dataTemplate as HierarchicalDataTemplate;

            if (hierarchicalDataTemplate != null)
            {
                bool flag  = base.ItemTemplate == parentItemsControl.ItemTemplate;
                bool flag2 = base.ItemContainerStyle == parentItemsControl.ItemContainerStyle;
                if (hierarchicalDataTemplate.ItemsSource != null && !base.HasNonDefaultValue(ItemsControl.ItemsSourceProperty))
                {
                    base.SetBinding(ItemsControl.ItemsSourceProperty, hierarchicalDataTemplate.ItemsSource);
                }
                if (hierarchicalDataTemplate.IsItemStringFormatSet && base.ItemStringFormat == parentItemsControl.ItemStringFormat)
                {
                    base.ClearValue(ItemsControl.ItemTemplateProperty);
                    base.ClearValue(ItemsControl.ItemTemplateSelectorProperty);
                    base.ClearValue(ItemsControl.ItemStringFormatProperty);
                    bool flag3 = hierarchicalDataTemplate.ItemStringFormat != null;
                    if (flag3)
                    {
                        base.ItemStringFormat = hierarchicalDataTemplate.ItemStringFormat;
                    }
                }
                if (hierarchicalDataTemplate.IsItemTemplateSelectorSet && base.ItemTemplateSelector == parentItemsControl.ItemTemplateSelector)
                {
                    base.ClearValue(ItemsControl.ItemTemplateProperty);
                    base.ClearValue(ItemsControl.ItemTemplateSelectorProperty);
                    bool flag4 = hierarchicalDataTemplate.ItemTemplateSelector != null;
                    if (flag4)
                    {
                        base.ItemTemplateSelector = hierarchicalDataTemplate.ItemTemplateSelector;
                    }
                }
                if (hierarchicalDataTemplate.IsItemTemplateSet && flag)
                {
                    base.ClearValue(ItemsControl.ItemTemplateProperty);
                    bool flag5 = hierarchicalDataTemplate.ItemTemplate != null;
                    if (flag5)
                    {
                        base.ItemTemplate = hierarchicalDataTemplate.ItemTemplate;
                    }
                }
                if (hierarchicalDataTemplate.IsItemContainerStyleSelectorSet && base.ItemContainerStyleSelector == parentItemsControl.ItemContainerStyleSelector)
                {
                    base.ClearValue(ItemsControl.ItemContainerStyleProperty);
                    base.ClearValue(ItemsControl.ItemContainerStyleSelectorProperty);
                    bool flag6 = hierarchicalDataTemplate.ItemContainerStyleSelector != null;
                    if (flag6)
                    {
                        base.ItemContainerStyleSelector = hierarchicalDataTemplate.ItemContainerStyleSelector;
                    }
                }
                if (hierarchicalDataTemplate.IsItemContainerStyleSet && flag2)
                {
                    base.ClearValue(ItemsControl.ItemContainerStyleProperty);
                    bool flag7 = hierarchicalDataTemplate.ItemContainerStyle != null;
                    if (flag7)
                    {
                        base.ItemContainerStyle = hierarchicalDataTemplate.ItemContainerStyle;
                    }
                }
                if (hierarchicalDataTemplate.IsAlternationCountSet && base.AlternationCount == parentItemsControl.AlternationCount)
                {
                    base.ClearValue(ItemsControl.AlternationCountProperty);
                    bool flag8 = true;
                    if (flag8)
                    {
                        base.AlternationCount = hierarchicalDataTemplate.AlternationCount;
                    }
                }
                if (hierarchicalDataTemplate.IsItemBindingGroupSet && base.ItemBindingGroup == parentItemsControl.ItemBindingGroup)
                {
                    base.ClearValue(ItemsControl.ItemBindingGroupProperty);
                    bool flag9 = hierarchicalDataTemplate.ItemBindingGroup != null;
                    if (flag9)
                    {
                        base.ItemBindingGroup = hierarchicalDataTemplate.ItemBindingGroup;
                    }
                }
            }
        }
 protected virtual void OnViewTemplateSelectorChanged(DataTemplateSelector oldValue, DataTemplateSelector newValue) { }
Ejemplo n.º 11
0
        //------------------------------------------------------
        //
        //  Internal methods
        //
        //------------------------------------------------------

        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareContentPresenter(object item,
                                DataTemplate itemTemplate,
                                DataTemplateSelector itemTemplateSelector,
                                string stringFormat)
        {
            if (item != this)
            {
                // copy templates from parent ItemsControl
                if (_contentIsItem || !HasNonDefaultValue(ContentProperty))
                {
                    Content = item;
                    _contentIsItem = true;
                }
                if (itemTemplate != null)
                    SetValue(ContentTemplateProperty, itemTemplate);
                if (itemTemplateSelector != null)
                    SetValue(ContentTemplateSelectorProperty, itemTemplateSelector);
                if (stringFormat != null)
                    SetValue(ContentStringFormatProperty, stringFormat);
            }
        }
Ejemplo n.º 12
0
 private void OnItemTemplateSelectorChanged(DataTemplateSelector p)
 {
     if (ListBox == null) return;
     ListBox.ItemTemplateSelector = p;
 }
Ejemplo n.º 13
0
		protected override void OnContentTemplateSelectorChanged (DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
		{
			base.OnContentTemplateSelectorChanged (oldContentTemplateSelector, newContentTemplateSelector);
			//WDTDH
		}
 protected virtual new void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
 {
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Called when the <see cref="ContentControl.ContentTemplateSelector"/> property changes.
 /// </summary>
 /// <param name="oldContentTemplateSelector">
 /// The old value of the <see cref="ContentControl.ContentTemplateSelector"/> property.
 /// </param>
 /// <param name="newContentTemplateSelector">
 /// The new value of the <see cref="ContentControl.ContentTemplateSelector"/> property.
 /// </param>
 protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
 {
     base.OnContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector);
     UpdateDockPaneContent();
 }
Ejemplo n.º 16
0
 /// <summary>
 ///     This method is invoked when the ContentTemplateSelector property changes.
 /// </summary>
 /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
 /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
 protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
 {
     Helper.CheckTemplateAndTemplateSelector("Content", ContentTemplateProperty, ContentTemplateSelectorProperty, this);
 }
 static AlbumGroupViewTemplateSelector()
 {
     Selector = new AlbumGroupViewTemplateSelector();
 }
Ejemplo n.º 18
0
        /// <summary>
        ///     This method is invoked when the ItemTemplateSelector property changes.
        /// </summary>
        /// <param name="oldItemTemplateSelector">The old value of the ItemTemplateSelector property.</param>
        /// <param name="newItemTemplateSelector">The new value of the ItemTemplateSelector property.</param>
        protected virtual void OnItemTemplateSelectorChanged(DataTemplateSelector oldItemTemplateSelector, DataTemplateSelector newItemTemplateSelector)
        {
            CheckTemplateSource();

            if ((_itemContainerGenerator != null) && (ItemTemplate == null))
            {
                _itemContainerGenerator.Refresh();
            }
        }
Ejemplo n.º 19
0
 internal void SetTitleTemplateSelector( DataTemplateSelector titleTemplateSelector )
 {
   this.SetValue( GroupLevelDescription.TitleTemplateSelectorProperty, titleTemplateSelector );
 }
 protected override void SetCurrentCellTemplateSelector(DataTemplateSelector selector)
 {
     _column.CellTemplateSelector = selector;
 }
Ejemplo n.º 21
0
 /// <summary>
 ///     This method is invoked when the HeaderTemplateSelector property changes.
 /// </summary>
 /// <param name="oldHeaderTemplateSelector">The old value of the HeaderTemplateSelector property.</param>
 /// <param name="newHeaderTemplateSelector">The new value of the HeaderTemplateSelector property.</param>
 protected virtual void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
 {
     Helper.CheckTemplateAndTemplateSelector("Header", HeaderTemplateProperty, HeaderTemplateSelectorProperty, this);
 }
 public static void SetCellTemplateSelector(this DataGrid element, DataTemplateSelector value)
 {
     element.SetValue(CellTemplateSelectorProperty, value);
 }
Ejemplo n.º 23
0
        // As a convenience for hierarchical data, get the header template and
        // if it's a HierarchicalDataTemplate, set the ItemsSource, ItemTemplate,
        // ItemTemplateSelector, and ItemStringFormat properties from the template.
        void PrepareHierarchy(object item, ItemsControl parentItemsControl)
        {
            // get the effective header template
            DataTemplate headerTemplate = HeaderTemplate;

            if (headerTemplate == null)
            {
                DataTemplateSelector selector = HeaderTemplateSelector;
                if (selector != null)
                {
                    headerTemplate = selector.SelectTemplate(item, this);
                }

                if (headerTemplate == null)
                {
                    headerTemplate = (DataTemplate)FindTemplateResourceInternal(this, item, typeof(DataTemplate));
                }
            }

            // if the effective template is a HierarchicalDataTemplate, forward
            // the special properties
            HierarchicalDataTemplate hTemplate = headerTemplate as HierarchicalDataTemplate;

            if (hTemplate != null)
            {
                bool templateMatches       = (ItemTemplate == parentItemsControl.ItemTemplate);
                bool containerStyleMatches = (ItemContainerStyle == parentItemsControl.ItemContainerStyle);

                if (hTemplate.ItemsSource != null && !HasNonDefaultValue(ItemsSourceProperty))
                {
                    SetBinding(ItemsSourceProperty, hTemplate.ItemsSource);
                }

                if (hTemplate.IsItemStringFormatSet && ItemStringFormat == parentItemsControl.ItemStringFormat)
                {
                    // if the HDT defines a string format, turn off the
                    // forwarding of ItemTemplate[Selector] (which would get in the way).
                    ClearValue(ItemTemplateProperty);
                    ClearValue(ItemTemplateSelectorProperty);

                    // forward the HDT's string format
                    ClearValue(ItemStringFormatProperty);
                    bool setItemStringFormat = (hTemplate.ItemStringFormat != null);
                    if (setItemStringFormat)
                    {
                        ItemStringFormat = hTemplate.ItemStringFormat;
                    }
                }

                if (hTemplate.IsItemTemplateSelectorSet && ItemTemplateSelector == parentItemsControl.ItemTemplateSelector)
                {
                    // if the HDT defines a template selector, turn off the
                    // forwarding of ItemTemplate (which would get in the way).
                    ClearValue(ItemTemplateProperty);

                    // forward the HDT's template selector
                    ClearValue(ItemTemplateSelectorProperty);
                    bool setItemTemplateSelector = (hTemplate.ItemTemplateSelector != null);
                    if (setItemTemplateSelector)
                    {
                        ItemTemplateSelector = hTemplate.ItemTemplateSelector;
                    }
                }

                if (hTemplate.IsItemTemplateSet && templateMatches)
                {
                    // forward the HDT's template
                    ClearValue(ItemTemplateProperty);
                    bool setItemTemplate = (hTemplate.ItemTemplate != null);
                    if (setItemTemplate)
                    {
                        ItemTemplate = hTemplate.ItemTemplate;
                    }
                }

                if (hTemplate.IsItemContainerStyleSelectorSet && ItemContainerStyleSelector == parentItemsControl.ItemContainerStyleSelector)
                {
                    // if the HDT defines a container-style selector, turn off the
                    // forwarding of ItemContainerStyle (which would get in the way).
                    ClearValue(ItemContainerStyleProperty);

                    // forward the HDT's container-style selector
                    ClearValue(ItemContainerStyleSelectorProperty);
                    bool setItemContainerStyleSelector = (hTemplate.ItemContainerStyleSelector != null);
                    if (setItemContainerStyleSelector)
                    {
                        ItemContainerStyleSelector = hTemplate.ItemContainerStyleSelector;
                    }
                }

                if (hTemplate.IsItemContainerStyleSet && containerStyleMatches)
                {
                    // forward the HDT's container style
                    ClearValue(ItemContainerStyleProperty);
                    bool setItemContainerStyle = (hTemplate.ItemContainerStyle != null);
                    if (setItemContainerStyle)
                    {
                        ItemContainerStyle = hTemplate.ItemContainerStyle;
                    }
                }

                if (hTemplate.IsAlternationCountSet && AlternationCount == parentItemsControl.AlternationCount)
                {
                    // forward the HDT's alternation count
                    ClearValue(AlternationCountProperty);
                    bool setAlternationCount = true;
                    if (setAlternationCount)
                    {
                        AlternationCount = hTemplate.AlternationCount;
                    }
                }

                if (hTemplate.IsItemBindingGroupSet && ItemBindingGroup == parentItemsControl.ItemBindingGroup)
                {
                    // forward the HDT's ItemBindingGroup
                    ClearValue(ItemBindingGroupProperty);
                    bool setItemBindingGroup = (hTemplate.ItemBindingGroup != null);
                    if (setItemBindingGroup)
                    {
                        ItemBindingGroup = hTemplate.ItemBindingGroup;
                    }
                }
            }
        }
Ejemplo n.º 24
0
		public static void SetDragAdornerTemplateSelector(DependencyObject element, DataTemplateSelector value)
		{
			element.SetValue(DragAdornerTemplateSelectorProperty, value);
		}
Ejemplo n.º 25
0
 /// <summary>
 /// Sets the value of the LabelContentTemplateSelector attached property
 /// for a given dependency object. 
 /// </summary>
 /// <param name="d">The object to which the property value
 /// is written.</param>
 /// <param name="value">Sets the LabelContentTemplateSelector value of the specified object.</param>
 public static void SetLabelContentTemplateSelector(DependencyObject d, DataTemplateSelector value)
 {
     d.SetValue(LabelContentTemplateSelectorProperty, value);
 }
		protected virtual void OnHeaderTemplateSelectorChanged (DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
		{
		}
Ejemplo n.º 27
0
 protected virtual void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
 {
     if (HeaderTemplate != null && newHeaderTemplateSelector != null)
         Trace.TraceError("HeaderTemplate and HeaderTemplateSelector defined");
 }
Ejemplo n.º 28
0
        /// <summary>
        ///     This method is invoked when the ContentTemplateSelector property changes.
        /// </summary>
        /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
        /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
        protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
        {
            Helper.CheckTemplateAndTemplateSelector("Content", ContentTemplateProperty, ContentTemplateSelectorProperty, this);

            // if ContentTemplateSelector is really changing (and in use), remove the old template
            this.Template = null;
        }
Ejemplo n.º 29
0
        /// <summary>
        ///     Returns either the specified CellTemplate[Selector] or CellEditingTemplate[Selector].
        ///     CellTemplate[Selector] is the fallack if CellEditingTemplate[Selector] is null.
        /// </summary>
        /// <param name="isEditing">Whether the editing template is requested.</param>
        private void ChooseCellTemplateAndSelector(bool isEditing, out DataTemplate template, out DataTemplateSelector templateSelector)
        {
            template         = null;
            templateSelector = null;

            if (isEditing)
            {
                template         = CellEditingTemplate;
                templateSelector = CellEditingTemplateSelector;
            }

            if (template == null && templateSelector == null)
            {
                template         = CellTemplate;
                templateSelector = CellTemplateSelector;
            }
        }
 // Token: 0x06004410 RID: 17424 RVA: 0x00136594 File Offset: 0x00134794
 internal void PrepareContentPresenter(object item, DataTemplate itemTemplate, DataTemplateSelector itemTemplateSelector, string stringFormat)
 {
     if (item != this)
     {
         if (this._contentIsItem || !base.HasNonDefaultValue(ContentPresenter.ContentProperty))
         {
             this.Content        = item;
             this._contentIsItem = true;
         }
         if (itemTemplate != null)
         {
             base.SetValue(ContentPresenter.ContentTemplateProperty, itemTemplate);
         }
         if (itemTemplateSelector != null)
         {
             base.SetValue(ContentPresenter.ContentTemplateSelectorProperty, itemTemplateSelector);
         }
         if (stringFormat != null)
         {
             base.SetValue(ContentPresenter.ContentStringFormatProperty, stringFormat);
         }
     }
 }
Ejemplo n.º 31
0
        /// <summary>
        ///     This method is invoked when the ContentTemplateSelector property changes.
        /// </summary>
        /// <param name="oldContentTemplateSelector">The old value of the ContentTemplateSelector property.</param>
        /// <param name="newContentTemplateSelector">The new value of the ContentTemplateSelector property.</param>
        protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
        {
            base.OnContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector);

            // If this is the selected TabItem then we should update TabControl.SelectedContentTemplateSelector
            if (IsSelected)
            {
                TabControl tabControl = TabControlParent;
                if (tabControl != null)
                {
                    tabControl.SelectedContentTemplateSelector = newContentTemplateSelector;
                }
            }
        }
Ejemplo n.º 32
0
 protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector);
Ejemplo n.º 33
0
		protected virtual void OnItemTemplateSelectorChanged (DataTemplateSelector oldItemTemplateSelector, DataTemplateSelector newItemTemplateSelector)
		{
			//WDTDH
		}
Ejemplo n.º 34
0
        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareContentControl(object item,
                                        DataTemplate itemTemplate,
                                        DataTemplateSelector itemTemplateSelector,
                                        string itemStringFormat)
        {
            if (item != this)
            {
                // don't treat Content as a logical child
                ContentIsNotLogical = true;

                // copy styles from the ItemsControl
                if (ContentIsItem || !HasNonDefaultValue(ContentProperty))
                {
                    Content = item;
                    ContentIsItem = true;
                }
                if (itemTemplate != null)
                    SetValue(ContentTemplateProperty, itemTemplate);
                if (itemTemplateSelector != null)
                    SetValue(ContentTemplateSelectorProperty, itemTemplateSelector);
                if (itemStringFormat != null)
                    SetValue(ContentStringFormatProperty, itemStringFormat);
            }
            else
            {
                ContentIsNotLogical = false;
            }
        }
        /// <summary>
        /// Prepare to display the item.
        /// </summary>
        internal void PrepareHeaderedContentControl(object item,
                                        DataTemplate itemTemplate,
                                        DataTemplateSelector itemTemplateSelector,
                                        string stringFormat)
        {
            if (item != this)
            {
                // don't treat Content as a logical child
                ContentIsNotLogical = true;
                HeaderIsNotLogical = true;

                if (ContentIsItem || !HasNonDefaultValue(ContentProperty))
                {
                    Content = item;
                    ContentIsItem = true;
                }

                // Visuals can't be placed in both Header and Content, but data can
                if (!(item is Visual) && (HeaderIsItem || !HasNonDefaultValue(HeaderProperty)))
                {
                    Header = item;
                    HeaderIsItem = true;
                }

                if (itemTemplate != null)
                    SetValue(HeaderTemplateProperty, itemTemplate);
                if (itemTemplateSelector != null)
                    SetValue(HeaderTemplateSelectorProperty, itemTemplateSelector);
                if (stringFormat != null)
                    SetValue(HeaderStringFormatProperty, stringFormat);
            }
            else
            {
                ContentIsNotLogical = false;
            }
        }
Ejemplo n.º 36
0
 // Token: 0x06004E42 RID: 20034 RVA: 0x00160450 File Offset: 0x0015E650
 internal void PrepareHeaderedContentControl(object item, DataTemplate itemTemplate, DataTemplateSelector itemTemplateSelector, string stringFormat)
 {
     if (item != this)
     {
         base.ContentIsNotLogical = true;
         this.HeaderIsNotLogical  = true;
         if (base.ContentIsItem || !base.HasNonDefaultValue(ContentControl.ContentProperty))
         {
             base.Content       = item;
             base.ContentIsItem = true;
         }
         if (!(item is Visual) && (this.HeaderIsItem || !base.HasNonDefaultValue(HeaderedContentControl.HeaderProperty)))
         {
             this.Header       = item;
             this.HeaderIsItem = true;
         }
         if (itemTemplate != null)
         {
             base.SetValue(HeaderedContentControl.HeaderTemplateProperty, itemTemplate);
         }
         if (itemTemplateSelector != null)
         {
             base.SetValue(HeaderedContentControl.HeaderTemplateSelectorProperty, itemTemplateSelector);
         }
         if (stringFormat != null)
         {
             base.SetValue(HeaderedContentControl.HeaderStringFormatProperty, stringFormat);
             return;
         }
     }
     else
     {
         base.ContentIsNotLogical = false;
     }
 }
Ejemplo n.º 37
0
 public static void SetTemplateSelector(DependencyObject obj, DataTemplateSelector value)
 {
     obj.SetValue(TemplateSelectorProperty, value);
 }
Ejemplo n.º 38
0
 public static void SetContentTemplateSelector(DependencyObject dc, DataTemplateSelector value)
 {
     dc.SetValue(ContentTemplateSelectorProperty, value);
 }
 protected virtual new void OnItemTemplateSelectorChanged(DataTemplateSelector oldItemTemplateSelector, DataTemplateSelector newItemTemplateSelector)
 {
 }
Ejemplo n.º 40
0
 protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector);
 public static object CreateAndInitializeView(IViewLocator viewLocator, string documentType, object parameter, object parentViewModel = null, bool useParameterAsViewModel = false, DataTemplate viewTemplate = null, DataTemplateSelector viewTemplateSelector = null) {
     if(useParameterAsViewModel)
         return CreateAndInitializeView(viewLocator, documentType, parameter, parameter, parentViewModel, viewTemplate, viewTemplateSelector);
     else
         return CreateAndInitializeView(viewLocator, documentType, null, parameter, parentViewModel, viewTemplate, viewTemplateSelector);
 }
 /// <summary>
 ///     This method is invoked when the HeaderTemplateSelector property changes.
 /// </summary>
 /// <param name="oldHeaderTemplateSelector">The old value of the HeaderTemplateSelector property.</param>
 /// <param name="newHeaderTemplateSelector">The new value of the HeaderTemplateSelector property.</param>
 protected virtual void OnHeaderTemplateSelectorChanged(DataTemplateSelector oldHeaderTemplateSelector, DataTemplateSelector newHeaderTemplateSelector)
 {
     Helper.CheckTemplateAndTemplateSelector("Header", HeaderTemplateProperty, HeaderTemplateSelectorProperty, this);
 }
 public static object CreateAndInitializeView(IViewLocator viewLocator, string documentType, object viewModel, object parameter, object parentViewModel, DataTemplate viewTemplate = null, DataTemplateSelector viewTemplateSelector = null) {
     object view = CreateView(viewLocator, documentType, viewTemplate, viewTemplateSelector);
     InitializeView(view, viewModel, parameter, parentViewModel);
     return view;
 }
 protected override void OnViewTemplateSelectorChanged(DataTemplateSelector oldValue, DataTemplateSelector newValue) {
     throw new InvalidOperationException("ViewTemplateSelector is not supported by DXSplashScreenService");
 }
        /// <summary>
        ///     Returns either the specified CellTemplate[Selector] or CellEditingTemplate[Selector].
        ///     CellTemplate[Selector] is the fallack if CellEditingTemplate[Selector] is null.
        /// </summary>
        /// <param name="isEditing">Whether the editing template is requested.</param>
        private void ChooseCellTemplateAndSelector(bool isEditing, out DataTemplate template, out DataTemplateSelector templateSelector)
        {
            template = null;
            templateSelector = null;

            if (isEditing)
            {
                template = CellEditingTemplate;
                templateSelector = CellEditingTemplateSelector;
            }

            if (template == null && templateSelector == null)
            {
                template = CellTemplate;
                templateSelector = CellTemplateSelector;
            }
        }
 protected abstract void SetCurrentCellTemplateSelector(DataTemplateSelector selector);
Ejemplo n.º 47
0
 protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector)
 {
 }