Ejemplo n.º 1
0
        public OpenFromGacDialog()
        {
            InitializeComponent();
            listView.ItemsSource = filteredEntries;
            SortableGridViewColumn.SetCurrentSortColumn(listView, nameColumn);
            SortableGridViewColumn.SetSortDirection(listView, ColumnSortDirection.Ascending);

            new Thread(new ThreadStart(FetchGacContents)).Start();
        }
        public OpenFromGacDialog()
        {
            InitializeComponent();
            FormLocationHelper.ApplyWindow(this, "ICSharpCode.SharpDevelop.Dom.OpenFromGacDialog.Bounds", true);
            listView.ItemsSource = filteredEntries;
            SortableGridViewColumn.SetCurrentSortColumn(listView, nameColumn);
            SortableGridViewColumn.SetSortDirection(listView, ColumnSortDirection.Ascending);

            new Thread(new ThreadStart(FetchGacContents)).Start();
        }
Ejemplo n.º 3
0
        public UpgradeView(Solution solution)
        {
            if (solution == null)
            {
                throw new ArgumentNullException("solution");
            }
            this.solution = solution;
            InitializeComponent();

            this.entries         = solution.Projects.OfType <IUpgradableProject>().Select(p => new Entry(p)).ToList();
            listView.ItemsSource = entries;
            SortableGridViewColumn.SetCurrentSortColumn(listView, nameColumn);
            SortableGridViewColumn.SetSortDirection(listView, ColumnSortDirection.Ascending);
            ListView_SelectionChanged(null, null);
        }
        /// <summary>
        /// sorts the grid view by a specified column
        /// </summary>
        /// <param name="sortableGridViewColumn">The column to sort</param>
        public void ApplySort(SortableGridViewColumn sortableGridViewColumn)
        {
            // ensure that the column header is the correct type and a sort property has been set.
            if (sortableGridViewColumn != null && !String.IsNullOrEmpty(sortableGridViewColumn.SortPropertyName))
            {
                if (Comparer == null) //default sort
                {
                    //get the default collevtion view
                    parentControl.Items.SortDescriptions.Clear();
                    SortDescription sd = new SortDescription(
                        sortableGridViewColumn.SortPropertyName, sortableGridViewColumn.SortDirection);
                    parentControl.Items.SortDescriptions.Add(sd);
                }
                else
                {
                    //get a collection view
                    ListCollectionView defaultCollectionView =
                        CollectionViewSource.GetDefaultView(parentControl.ItemsSource) as ListCollectionView;
                    if (defaultCollectionView != null)
                    {
                        Comparer.Direction               = sortableGridViewColumn.SortDirection;
                        Comparer.SortPropertyName        = sortableGridViewColumn.SortPropertyName;
                        defaultCollectionView.CustomSort = comparer;
                    }
                }

                sortableGridViewColumn.SetSortDirection();//reset the direction

                bool newSortColumn = false;
                // determine if this is a new sort
                if (lastSortedOnColumn == null ||
                    String.IsNullOrEmpty(lastSortedOnColumn.SortPropertyName) ||
                    !String.Equals(sortableGridViewColumn.SortPropertyName, lastSortedOnColumn.SortPropertyName, StringComparison.InvariantCultureIgnoreCase))
                {
                    newSortColumn = true;
                }

                //apply the templates
                if (sortableGridViewColumn.SortDirection == ListSortDirection.Ascending)
                {
                    if (!String.IsNullOrEmpty(this.ColumnHeaderSortedAscendingTemplate))
                    {
                        sortableGridViewColumn.HeaderTemplate = parentControl.TryFindResource(ColumnHeaderSortedAscendingTemplate) as DataTemplate;
                    }
                    else
                    {
                        sortableGridViewColumn.HeaderTemplate = null;
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(this.ColumnHeaderSortedDescendingTemplate))
                    {
                        sortableGridViewColumn.HeaderTemplate = parentControl.TryFindResource(ColumnHeaderSortedDescendingTemplate) as DataTemplate;
                    }
                    else
                    {
                        sortableGridViewColumn.HeaderTemplate = null;
                    }
                }

                // Remove arrow from previously sorted header
                if (newSortColumn && lastSortedOnColumn != null)
                {
                    if (!String.IsNullOrEmpty(this.ColumnHeaderNotSortedTemplate))
                    {
                        lastSortedOnColumn.HeaderTemplate = parentControl.TryFindResource(ColumnHeaderNotSortedTemplate) as DataTemplate;
                    }
                    else
                    {
                        lastSortedOnColumn.HeaderTemplate = null;
                    }
                }

                lastSortedOnColumn = sortableGridViewColumn;
            }
        }