Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am using Autocomplete box ,once after selecting item from dropdown the item is not showing starting text ,it's showing only ending text


Assume the textbox width is 100 ,if the length of selected item in autocomplete is large ,the autocomplete instead of showing text from starting it's showing only the last end of string (ie visible part in textbox)

plz help me in this ...
Posted

AutoCompleteBox is made up of TextBox and few components. The control does not expose the TextBox control. So you cannot achieve your idea unless you derived and customize the control.

Derived AutoCompleteBoxEx from AutoCompleteBox and add a public Property/Method to return the TextBox used inside the control. Then you can try the below example.

Try,

C#
textBox.CaretIndex = 0;


after you selected the item from the AutoComplete box
 
Share this answer
 
v2
Comments
Gopinath Sugumar 17-Mar-11 4:45am    
Hi ,there is no Such Property CaretIndex in Silverlight AutocompleteBox
Venkatesh Mookkan 17-Mar-11 6:51am    
Answer updated
hi I got solution before week itself ,the Autocomplete box is composed of many things among that textbox is also one ,so we need to get the textbox from the autocomplete by traversing the tree

Inside the last focus of autocomplte box we can put like

AutoCompleteBox autoObject = sender as AutoCompleteBox;
         TextBox textObject = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(autoObject, 0), 0) as TextBox;
         textObject.SelectAll();
         textObject.SelectionLength = 0;



so that the begining part of text will be diplayed on autocomplete last focus

Cheers,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900