BrightIdeasSoftware.ObjectListView.ShowSortIndicator C# (CSharp) Method

ShowSortIndicator() protected method

Put a sort indicator next to the text of the given given column
protected ShowSortIndicator ( OLVColumn columnToSort, SortOrder sortOrder ) : void
columnToSort OLVColumn The column to be marked
sortOrder SortOrder The sort order in effect on that column
return void
        protected virtual void ShowSortIndicator(OLVColumn columnToSort, SortOrder sortOrder)
        {
            int imageIndex = -1;

            if (!NativeMethods.HasBuiltinSortIndicators()) {
                // If we can't use builtin image, we have to make and then locate the index of the
                // sort indicator we want to use. SortOrder.None doesn't show an image.
                if (this.SmallImageList == null || !this.SmallImageList.Images.ContainsKey(SORT_INDICATOR_UP_KEY))
                    MakeSortIndicatorImages();

                imageIndex = this.SmallImageList.Images.IndexOfKey(sortOrder == SortOrder.Ascending ? SORT_INDICATOR_UP_KEY : SORT_INDICATOR_DOWN_KEY);
            }

            // Set the image for each column
            for (int i = 0; i < this.Columns.Count; i++) {
                if (columnToSort != null && i == columnToSort.Index)
                    NativeMethods.SetColumnImage(this, i, sortOrder, imageIndex);
                else
                    NativeMethods.SetColumnImage(this, i, SortOrder.None, -1);
            }
        }

Same methods

ObjectListView::ShowSortIndicator ( ) : void
ObjectListView