For that you have to maintain a count variable to know how many rows are filled. This can be done by counting the number of rows in the datatable and add them to the count in the for loop
count = count + dt.RowCount
And whatever you are searching in the search window is the same variable you need to pass here as well
And sorry I dint take a look at your xaml yet. If you can upload as a zip file that would be great
cheers