Data Filtering in a ListView [WPF]

Поделиться
HTML-код
  • Опубликовано: 13 фев 2022
  • In this tutorial I demonstrate how to filter data in a listview control

Комментарии • 15

  • @maxdesko
    @maxdesko Год назад

    Great video, very straight forward, well explained. Thanks!!

  • @rodelioliwag7627
    @rodelioliwag7627 Год назад

    Thank you very much. This is a treat,

  • @ganapathipasupathi1666
    @ganapathipasupathi1666 Год назад

    It is very useful to me, Super man 👌

  • @Locrum
    @Locrum Год назад +1

    Very useful. How would you implement this using MVVM? Also, if you wanted to filter by Country, then by status, how would that work?

  • @MG-vm9pf
    @MG-vm9pf 2 года назад

    Thank you so much!

  • @wojciechspirin4984
    @wojciechspirin4984 2 года назад +1

    Great tutorial, nicely explained ;) You also cloud use INotfiyPropertyChanged interface to observe if Textbox or ComboBox have been changed ;) Anyway great tutorial ;)

    • @TacticDevs
      @TacticDevs  2 года назад +3

      Thank you for your advice , I usually try as much as possible to make it beginner friendly

  • @KecmarFIFA
    @KecmarFIFA Год назад

    Very useful tutorial, but I have problem when filtering with int values. Can you help me?

    • @KecmarFIFA
      @KecmarFIFA Год назад

      I tried like this but its not working -->
      private bool NumOfTouristsFilter(object obj)
      {
      var filterObj = obj as TourRequest;
      return filterObj.NumberOfTourists.Equals(FilterTextBox.Text);
      }

  • @nikex8496
    @nikex8496 Год назад

    How can I filter numbers oder dates like "21" or "26.10.1965" ?

    • @TacticDevs
      @TacticDevs  Год назад +1

      You can add a property of datetime type on the object. When you pass the object to the filter method,inside method you can access the datetime’s date,month,year then you can specify the conditions that the object should meet by specifying the date,month or year

    • @nikex8496
      @nikex8496 Год назад

      @@TacticDevs thanks for the fast answer. That sounds a bit complicated for me as a beginner, but makes sense. Maybe it is better when u have the list from a database and then filter? And btw i got the problem when i filter something else like "year" it doesn't work with the same code. The searchBox filters everytime the first and second group.

    • @TacticDevs
      @TacticDevs  Год назад +1

      @@nikex8496 so what I meant was if you’re trying to filter by a date you might want to store the date information in a property of the type datetime this way you can have control over what part of the date you want to filter by whether it’s the month,day or year

    • @TacticDevs
      @TacticDevs  Год назад +1

      So for example you would add another property to the user class in this case (date of birth),then when filtering you would filter by the date of birth property, for example you want to filter all the dates that are in the month March, in this video tutorial I was filtering by the name property in your case you would have to filter by the (date of birth)property

    • @TacticDevs
      @TacticDevs  Год назад +1

      So this piece of code you would write in your filter method
      If(User.Dateofbirth.day == 3)
      {
      return true;
      }
      else
      {
      return false;
      }
      So what this piece of code is saying is that if they user has date of birth that is in the month of March then add this user to the filtered list if not then exclude the user, to achieve this you have to add a property to the user a class of the type datetime