prolingua.geo

prolingua.geo


  • Name: [not set]
  • Favorite Languages: [not set]
  • Website: [not set]
  • Location: [not set]
  • About Me: [not set]

Recent Comments

  • WPF Tutorial - Using The ListView, Part 2 - Sorting
    02/21/2010 - 02:40

    thanks, great article and code.
    I have suggestion that would make the article code easier understand. I think the author should concentrate first on the sorting without involving the drawing of the ascending or descending graphics on the column header.
    So I would suggest the authour start with something like:

    private GridViewColumnHeader _CurSortCol = null;
            private ListSortDirection _CurDirCol;
            private SortAdorner _CurAdorner = null;
            public Window1()
            {
                _GameCollection.Add(new GameData
                {
                    GameName = "World Of Warcraft",
                    Creator = "Blizzard",
                    Publisher = "Blizzard"
                });
                _GameCollection.Add(new GameData
                {
                    GameName = "Halo",
                    Creator = "Bungie",
                    Publisher = "Microsoft"
                });
                _GameCollection.Add(new GameData
                {
                    GameName = "Gears Of War",
                    Creator = "Epic",
                    Publisher = "Microsoft"
                });
                InitializeComponent();
            }

            public ObservableCollection<GameData> GameCollection
            { get { return _GameCollection; } }

            private void AddRowClick(object sender, RoutedEventArgs e)
            {
                _GameCollection.Add(new GameData
                {
                    GameName = "A New Game",
                    Creator = "A New Creator",
                    Publisher = "A New Publisher"
                });
            }

            private void SortClick(object sender, RoutedEventArgs e)
            {
                GridViewColumnHeader column = sender as GridViewColumnHeader;
                String field = column.Tag as String;

                //if (_CurSortCol != null)
                //{
                    //AdornerLayer.GetAdornerLayer(_CurSortCol).Remove(_CurAdorner);
                    gameListView.Items.SortDescriptions.Clear();
                //}

                ListSortDirection newDir = ListSortDirection.Ascending;
                //if (_CurSortCol == column && _CurAdorner.Direction == newDir)
                if (_CurSortCol == column && _CurDirCol == newDir)
                    newDir = ListSortDirection.Descending;

                _CurSortCol = column;
                _CurDirCol = newDir;

                //_CurAdorner = new SortAdorner(_CurSortCol, newDir);
                //AdornerLayer.GetAdornerLayer(_CurSortCol).Add(_CurAdorner);
                gameListView.Items.SortDescriptions.Add(
                    new SortDescription(field, newDir));


            }

        }

    See that I added a class level variable _CurDirCol to determine the current direction.

    But it's really a great article. I predict Microsoft will make this functionality standard.

  • WPF Tutorial - Using The ListView, Part 1
    02/18/2010 - 11:21

    Hi A Person,
    I don't agree with you. I think the article is good.
    I think you'd better ask the author or other audience any parts you don't understand. That's much better than moaning.