Data Filtering in a ListView [WPF]

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ • 15

  • @maxdesko
    @maxdesko 2 роки тому

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

  • @rodelioliwag7627
    @rodelioliwag7627 Рік тому

    Thank you very much. This is a treat,

  • @Locrum
    @Locrum 2 роки тому +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?

  • @ganapathipasupathi1666
    @ganapathipasupathi1666 2 роки тому

    It is very useful to me, Super man 👌

  • @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

  • @Minaco053
    @Minaco053 Рік тому

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

    • @Minaco053
      @Minaco053 Рік тому

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

  • @MG-vm9pf
    @MG-vm9pf 2 роки тому

    Thank you so much!

  • @nikex8496
    @nikex8496 2 роки тому

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

    • @TacticDevs
      @TacticDevs  2 роки тому +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 2 роки тому

      @@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  2 роки тому +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  2 роки тому +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  2 роки тому +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