Question

I have a autocomplete textbox. It's data source is from a large database.When the user type anything it will match with the database and show matched data. My database have 2 columns one is named "english" and another is "bangla". my search input item will be the first column data(english column)

Now whenever the user select a item from the autocomplete textbox, then each time it will show the selected text and the respective value form 2nd column of the database.From the bellow image the first textblock is from "english" column and the 2nd textblock is from the "bangla" column. Here there will be 2 buttons. When the user press these button it will show the text of the first textblock. .

enter image description here I just can add the first column data as the source of the autocompletetextbox like this:

mylist = new List<string>();
        //string word = textBox1.Text;


        var contacts = (from m in db.Dics select new { m.English });


        foreach (var a in contacts)
        {
            s1 = a.English;


            mylist.Add(s1);
        }


        this.kk.ItemsSource = mylist; // kk is my autocomplete textbox

My autocomplete textbox in xaml:

    <Grid x:Name="contentpanel" Grid.Row="1" >
      <StackPanel>
        <toolkit:AutoCompleteBox x:Name="kk"/>
        </StackPanel>
    </Grid>

Now when the user select a item how can i show this text and it's respective value of from the DB and also implement the button action there. Can anyone help me???

No correct solution

OTHER TIPS

May this will solve your problem.

<Grid x:Name="contentpanel" Grid.Row="1" >
 <StackPanel>
  <toolkit:AutoCompleteBox x:Name="kk" FilterMode="StartsWith" SelectionChanged="kk_SelectionChanged"/>
  </StackPanel>
</Grid>


private void txtFodd_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
 if (e.AddedItems.Count == 0)
   return;
 string mylistItem = (string)e.AddedItems[0];
//Now perform your query with Db with mylistitem string 
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top