How to Set ItemSource of Autocomplete Textbox when placed inside Datagrid and that datagrid having multiple rows???
-
Hi, I am new to SilverLight, I have created one test Application having Datagrid and Autocomplete Text box which is placed inside the datagrid,Now if the there is only one row i am able to set itemsource of the Autocomplete text box but for multiple rows how to find the control and set the itemsource? Please help... Thanks & Best Regards Shwetank
-
Hi, I am new to SilverLight, I have created one test Application having Datagrid and Autocomplete Text box which is placed inside the datagrid,Now if the there is only one row i am able to set itemsource of the Autocomplete text box but for multiple rows how to find the control and set the itemsource? Please help... Thanks & Best Regards Shwetank
Please check this tutorial... http://www.c-sharpcorner.com/UploadFile/dpatra/auto-complete-in-datagrid-cell-editing-in-silverlight-3-application/[^] hope it helps...
-
Please check this tutorial... http://www.c-sharpcorner.com/UploadFile/dpatra/auto-complete-in-datagrid-cell-editing-in-silverlight-3-application/[^] hope it helps...
Hi, Thanks for the reply, I have already visited the link mentioned, the thing is in that i am using WCF service to get the data from database and i have placed Autocomplete textbox Control inside the datagrid for one row i am able to find the control and add the itemsource but if there are multiple rows then how do i do that? Thanks & Best Regards Shwetank
-
Hi, Thanks for the reply, I have already visited the link mentioned, the thing is in that i am using WCF service to get the data from database and i have placed Autocomplete textbox Control inside the datagrid for one row i am able to find the control and add the itemsource but if there are multiple rows then how do i do that? Thanks & Best Regards Shwetank
It can be done in two ways... if the data to be binded to AutoComplete textbox is large, bind that collection to Autocomplete box by setting the datacontext to parent element of datagrid or first control in the page(we usually use grid as the main content holder) where that datacontext holds the Autocomplete collection and bind it to AutoCompleteBox. Here in this sample, they are binding some static resource. you can replace it with your collection and it gets binded.(Same collection gets binded to all AutoCompleteBox).
<input:AutoCompleteBox
HorizontalAlignment="Left" Width="180" IsTabStop="True" Text="{Binding UserName, Mode=TwoWay}" ItemsSource="{StaticResource SampleHeroes}" />
another solution is if you want different collection to be binded, you can add one more property to Users class (in this sample) which holds the collection and you can bind it directly inside AutoCompleteBox.... e.g new Users{ UserName="Hiro Nakamura", Age=24, Gender="M", Country="Japan", AutoCompleteList = new List{"Hi","Hello","Welcome","Bye" } } But it does not seems to be good... you can use the first approach.
-
It can be done in two ways... if the data to be binded to AutoComplete textbox is large, bind that collection to Autocomplete box by setting the datacontext to parent element of datagrid or first control in the page(we usually use grid as the main content holder) where that datacontext holds the Autocomplete collection and bind it to AutoCompleteBox. Here in this sample, they are binding some static resource. you can replace it with your collection and it gets binded.(Same collection gets binded to all AutoCompleteBox).
<input:AutoCompleteBox
HorizontalAlignment="Left" Width="180" IsTabStop="True" Text="{Binding UserName, Mode=TwoWay}" ItemsSource="{StaticResource SampleHeroes}" />
another solution is if you want different collection to be binded, you can add one more property to Users class (in this sample) which holds the collection and you can bind it directly inside AutoCompleteBox.... e.g new Users{ UserName="Hiro Nakamura", Age=24, Gender="M", Country="Japan", AutoCompleteList = new List{"Hi","Hello","Welcome","Bye" } } But it does not seems to be good... you can use the first approach.
Hi, I tried using '' Tag but not getting.... Please find below the code i have tried...
-
Hi, I tried using '' Tag but not getting.... Please find below the code i have tried...
it depends on the references you are using... you arealready using AutoCompleteBox in your app.so use the same but instead relpce its itemsource with a property name
-
it depends on the references you are using... you arealready using AutoCompleteBox in your app.so use the same but instead relpce its itemsource with a property name
Hi, Could you please share sample code that would really help me a lot. and one more doubt: to get the city list there is one function written in .svc class, it is returning Generic List so how to convert that to objectCollection... Thanks & Best Regards Shwetank