/// <summary>Sets the styles, templates, and bindings for a <see cref="T:System.Windows.Controls.ListViewItem" />.</summary>
        /// <param name="element">An object that is a <see cref="T:System.Windows.Controls.ListViewItem" /> or that can be converted into one.</param>
        /// <param name="item">The object to use to create the <see cref="T:System.Windows.Controls.ListViewItem" />.</param>
        // Token: 0x06005169 RID: 20841 RVA: 0x0016D300 File Offset: 0x0016B500
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);
            ListViewItem listViewItem = element as ListViewItem;

            if (listViewItem != null)
            {
                ViewBase view = this.View;
                if (view != null)
                {
                    listViewItem.SetDefaultStyleKey(view.ItemContainerDefaultStyleKey);
                    view.PrepareItem(listViewItem);
                    return;
                }
                listViewItem.ClearDefaultStyleKey();
            }
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------
        //
        //  Protected Methods
        //
        //-------------------------------------------------------------------

        #region Protected Methods

        /// <summary>
        /// Prepare the element to display the item. Override the default style
        /// if new view is a GridView and no ItemContainerStyle provided.
        /// Will call View.PrepareItem() to allow view do preparison for item.
        /// </summary>
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);

            ListViewItem lvi = element as ListViewItem;

            if (lvi != null)
            {
                ViewBase view = View;
                if (view != null)
                {
                    // update default style key
                    lvi.SetDefaultStyleKey(view.ItemContainerDefaultStyleKey);
                    view.PrepareItem(lvi);
                }
                else
                {
                    lvi.ClearDefaultStyleKey();
                }
            }
        }