This is a migrated thread and some comments may be shown as answers.

Items filtering and search highlighting

9 Answers 36 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alexey
Top achievements
Rank 1
Alexey asked on 03 Jul 2014, 07:20 AM
Hello
First of all I'll describe what I want to get. I have a list of items. I need a search in this list and highlighting found text.
I don't want use CollectionViewSource for filtering, because of its special handing of SelectedItem (IsSynchronizedWithCurrentItem="True" is a bad idea, because I need behavior when no item selected, IsSynchronizedWithCurrentItem="False" also not good because when ListBox.SelectedItem has some value then correcponding item in list is not highlighted).
The best I've found is JumpList, because it have filters and working with SelectedItem as I want.
The second problem is search highlighting. In item template I've added RichTextBox with three runs:
<Run Text="{Binding Name, Converter={StaticResource TextBeforePattern}}" Foreground="{Binding Path=., Converter={StaticResource selectedColorConverter}}"/><Run Text="{Binding Name, Converter={StaticResource TextPattern}}" Foreground="{Binding Path=., Converter={StaticResource searchColorConverter}}"/><Run Text="{Binding Name, Converter={StaticResource TextAfterPattern}}" Foreground="{Binding Path=., Converter={StaticResource selectedColorConverter}}"/>
Each converter checks return a part of the Name property: text before found pattern, pattern and text after found patter (example, Name="Integration", SearchPattern="gra"; part of text are: "Inte", "gra", "tion").

But I've found problem: if JumpList item after filtering didn't change its position (e.g. first item in list), then JumpList will not update it and search pattern in this item will not highlighted. Example, list contains items "aaa", "aab", "bcd", "zza"; setting search pattern to "a"; as result "aaa", "aab", "zza"; but becasue of "aaa" and "aab" didn't change their position JumpList will update only "zza" item and only "zza" will get highlighting.

Any suggestion?

9 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 07 Jul 2014, 04:36 PM
Hello Alexey,

Thank you for contacting us.

You can use the RadJumpList.RefreshData() method to force the list to update its data. You may also want to take a look at this article from our online documentation that demonstrates how to use the RadAutoComplete box to filter the items in an external control: http://www.telerik.com/help/windows-phone/radautocompletebox-features-filteredsuggestions.html

I hope this helps. Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alexey
Top achievements
Rank 1
answered on 07 Jul 2014, 04:57 PM
I used exactly RefreshData() method. But I've described case in which some items are not updating.
Thanks for link to example. I'll try it
0
Rosy Topchiyska
Telerik team
answered on 10 Jul 2014, 11:39 AM
Hi Alexey,

Unfortunately, we could not reproduce this problem on our side. The RefreshData() method reevaluates the template of each item in the control when called. Could you please send us a sample project that reproduces the issue and we will try to find out where the problems comes from.

I look forward to your reply.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alexey
Top achievements
Rank 1
answered on 10 Jul 2014, 06:19 PM

Here is example.

Try to enter only one character in input box (e.g. "b", "bc" etc.). Sometimes it could work, but in most cases - not. Filter is working, items are filtering but templates are not updating

0
Alexey
Top achievements
Rank 1
answered on 10 Jul 2014, 06:20 PM
P.S. Rename PhoneApp1.png to PhoneApp1.zip because forum didn't allow me attach archive
0
Alexey
Top achievements
Rank 1
answered on 10 Jul 2014, 07:15 PM
I've discovered interesting thing: If I'm using list of s strings as data source then highlighting is ok, all items are updating after calling RefreshData. But of I'm using list of some class instances then not all items are refreshing after RefreshData call.
0
Accepted
Rosy Topchiyska
Telerik team
answered on 15 Jul 2014, 08:30 AM
Hi Alexey,

Thank you for the project.

You will have to raise the PropertyChanged() event for the Model items when you wish to update the template of the RadJumpList items. Since the filter descriptor iterates through all items in the ItemsSource, it is convenient to raise the event in the descriptor predicate. I have attached a modified version of your project to demonstrate how to do this:
  • Your Model class inherits from the ViewModelBase class that provides support for property changed notifications and I have added RaisePropertyChanged(..) method.
  • In the filterByName descriptor predicate the Model.RaisePropertyChanged(..) method is called.

I hope this helps. Please, let us know if you have any other questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alexey
Top achievements
Rank 1
answered on 15 Jul 2014, 10:02 AM
Hello
Thank you for example. This one works as expected.
Also I want to point that current documentation doesn't have description for this behavior. I mean that with FilterDescriptor not all items in JumpList updates their templates, only items that changed their visibility or position because of filtering.
0
Rosy Topchiyska
Telerik team
answered on 18 Jul 2014, 08:09 AM
Hi Alexey,

Actually, this is the expected behavior of the control. The template is reapplied to all items from the list, but the DataTemplate has bindings only to your model. Since the model data is never changed, and you rely on external mechanism to update the template, the DataTemplate can not know when something has changed and reevaluate its bindings.

I hope this is useful. Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
JumpList
Asked by
Alexey
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Alexey
Top achievements
Rank 1
Share this question
or