Great tutorial, nicely explained ;) You also cloud use INotfiyPropertyChanged interface to observe if Textbox or ComboBox have been changed ;) Anyway great tutorial ;)
I tried like this but its not working --> private bool NumOfTouristsFilter(object obj) { var filterObj = obj as TourRequest; return filterObj.NumberOfTourists.Equals(FilterTextBox.Text); }
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
@@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.
@@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
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
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
Great video, very straight forward, well explained. Thanks!!
Thank you very much. This is a treat,
Very useful. How would you implement this using MVVM? Also, if you wanted to filter by Country, then by status, how would that work?
It is very useful to me, Super man 👌
Great tutorial, nicely explained ;) You also cloud use INotfiyPropertyChanged interface to observe if Textbox or ComboBox have been changed ;) Anyway great tutorial ;)
Thank you for your advice , I usually try as much as possible to make it beginner friendly
Very useful tutorial, but I have problem when filtering with int values. Can you help me?
I tried like this but its not working -->
private bool NumOfTouristsFilter(object obj)
{
var filterObj = obj as TourRequest;
return filterObj.NumberOfTourists.Equals(FilterTextBox.Text);
}
Thank you so much!
How can I filter numbers oder dates like "21" or "26.10.1965" ?
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
@@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.
@@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
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
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