I need to to Highlight the search result according to the text that is entered in the text box in windows phone 7,
the usual wpf code is not working in windows phone 7. . Somebody say how to achieve this in windows phone 7
Actually this is the xaml Listbox I'm using to populate the Contact list,
<ListBox Name="ContactList" ItemsSource="{Binding}" Margin="14,85,14,28" Foreground="White" SizeChanged="ContactList_SizeChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Border BorderThickness="2" HorizontalAlignment="Left" VerticalAlignment="Center" BorderBrush="{StaticResource PhoneAccentBrush}" >
<Image Source="{Binding Converter={StaticResource ContactPictureConverter}}" Width="48" Height="48" Stretch="Fill" Name="img1" />
</Border>
<TextBlock Name="ContactResults" Text="{Binding Path=DisplayName, Mode=OneWay}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Margin="18,8,0,0" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBox Name="contactFilterString" Margin="0,0,0,528" TextChanged="contactFilterString_TextChanged" />
C# Code,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
//using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.UserData;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.ObjectModel;
using Microsoft.Phone.Shell;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using System.Text.RegularExpressions;
namespace SmartContactsApp
{
public partial class MainPage : PhoneApplicationPage
{
private List<Address> lstAddress = new List<Address>();
public string addressJson = string.Empty;
// Constructor
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
CreateSecondaryTile();
}
/// <summary>
/// To List all the Contacts. . .
/// </summary>
private void ContactListing()
{
ContactList.DataContext = null;
Contacts cons = new Contacts();
cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
cons.SearchAsync(contactFilterString.Text, FilterKind.DisplayName, "Contacts");
}
/// <summary>
/// To Fetch All Contacts from Mobile Contacts. . .
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
try
{
ContactList.DataContext = e.Results;
}
catch (Exception)
{
throw;
}
}
private void contactFilterString_TextChanged(object sender, TextChangedEventArgs e)
{
ContactListing();
}
}
How to highlight in this,
Thanks in advance!