Exemplo n.º 1
0
 /// <summary>
 /// Unregisters from the grid columns events.
 /// </summary>
 private void UnregisterFromGridColumnsEvents()
 {
     if (this.mParentGridView != null)
     {
         this.mParentGridView.Synchronized -= this.OnGridViewSynchronized;
         this.mParentGridView = null;
     }
 }
        /// <summary>
        /// Method called when the parent tree list view template is applied.
        /// </summary>
        internal void OnParentTreeListViewTemplateApplied()
        {
            if (this.Count > 0)
            {
                // Setting the grid view.
                this.View = new ExtendedGridView();

                // Synchronizing the grid view.
                this.SynchronizeGridViewColumns();
            }
        }
        /// <summary>
        /// Inserts an item at the given index.
        /// </summary>
        /// <param name="pIndex">The index of the item.</param>
        /// <param name="pItem">The item to insert.</param>
        protected override void InsertItem(int pIndex, TreeListViewColumn pItem)
        {
            if (this.mOwner.InnerListView != null && this.Count == 0)
            {
                // The first column is added.
                this.View = new ExtendedGridView();
            }

            // Calling base method.
            base.InsertItem(pIndex, pItem);

            // Synchronizing the grid view.
            this.SynchronizeGridViewColumns();
        }
        /// <summary>
        /// Removes the item stores at the given position.
        /// </summary>
        /// <param name="pIndex">The posiiton of the item to remove.</param>
        protected override void RemoveItem(int pIndex)
        {
            if (this.mOwner.InnerListView != null && this.Count == 1)
            {
                // The last column is removed.
                this.View = null;
            }

            // Calling base method.
            base.RemoveItem(pIndex);

            // Synchronizing the grid view.
            this.SynchronizeGridViewColumns();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Registers to the grid columns event.
        /// </summary>
        private void RegisterToGridColumnsEvents()
        {
            if (this.ParentTreeListView == null || this.ParentTreeListView.InnerListView == null)
            {
                return;
            }

            // Registers on the column changed event to update the decorator clip region.
            this.mParentGridView = this.ParentTreeListView.InnerListView.View;
            if (this.mParentGridView != null)
            {
                // Assure you remove a previously registered delegate if passing twice with non null model.
                this.mParentGridView.Synchronized -= this.OnGridViewSynchronized;
                this.mParentGridView.Synchronized += this.OnGridViewSynchronized;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Called when the control template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Getting the parts from the control template.
            this.InnerListView = this.GetTemplateChild(PART_ListView) as ExtendedListView;
            this.mDefaultMessage = this.GetTemplateChild(PART_DefaultMessage) as Label;

            if  (   (this.InnerListView == null)
                ||  (this.mDefaultMessage == null)
                )
            {
                throw new Exception("TreeListView control template not correctly defined.");
            }

            IsParentTreeMultiColumnsBehavior.SetIsParentTreeMultiColumns(this, false);

            // Loading the view model.
            this.LoadViewModel();

            // Applying the selection option.
            this.InnerListView.SelectionModel.SelectionOption = this.mPendingSelectionOption;

            // Registering on the collection changed event for the selected and checked items.
            this.InnerListView.SelectionModel.SelectionChanged += this.OnInnerListViewSelectionChanged;
            this.InnerListView.CheckModel.ItemsViewModelToggled += this.OnInnerListItemsViewModelToggled;
            this.InnerListView.ItemViewModelsAdded += this.OnInnerListViewItemViewModelsAdded;
            this.InnerListView.ItemViewModelsRemoved += this.OnInnerListViewItemViewModelsRemoved;
            this.InnerListView.ItemViewModelDoubleClicked += this.OnInnerListViewItemViewModelDoubleClicked;

            // Setting the columns.
            TreeListViewColumnCollection lCollection = TreeListView.GetColumnsCollection(this) as TreeListViewColumnCollection;
            if (lCollection != null && lCollection.Count > 0)
            {
                // Creating the grid.
                ExtendedGridView lGridView = new ExtendedGridView(this.mResources, this.MultiColumnsItemContainerDefaultStyleKey);

                foreach (TreeListViewColumn lColumn in lCollection)
                {
                    if (lCollection[0] == lColumn)
                    {
                        lGridView.SetFirstColumn(lColumn);
                    }
                    else
                    {
                        lGridView.AddColumn(lColumn);
                    }
                }

                // Setting the grid view to the inner list.
                this.InnerListView.View = lGridView;

                IsParentTreeMultiColumnsBehavior.SetIsParentTreeMultiColumns(this, true);
            }
        }