2013-11-28 40 views
0

我正在製作Windows Phone應用程序,其中我必須使用自動完成框,並且自動完成框根據Windows手機規則具有有限的源容量,所以我希望我的自動完成文本框來動態改變其源按規定,以減少負載 這裏是我努力的代碼片段,但它不工作在C#中使用stringArray並將其分成2個部分用於自動填充框

string[] stringArray1 = { "Aberdeen Bazar", "Bakultala", etc }; 
string[] stringArray2 = { "Aberdeen Bazar", "Bakultala", etc }; 

我想這somethinglike

if (stringArray.Contains(txtphone.Text)) 
{ 
    //autcomplete text source 
    this.txtphone.SuggestionsSource = stringArray; 
} 
else 
{ 
    //autcomplete text source2 if reqired 
    this.txtphone.SuggestionsSource = stringArray2; 
} 

我只想邏輯如何,我可以把自動完成的來源分爲兩個部分 此外,如果可以訂購alphawise 即

if(txtphone .starts with letter from (a to o) 
{ 
    //autcomplete text source 
    this.txtphone.SuggestionsSource = stringArray; 
} 
else 
{ 
    //autcomplete text source2 
    this.txtphone.SuggestionsSource = stringArray2; 
} 

回答

0

我得到了解決,這是它

if (txtphone.Text.StartsWith("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O")) 
      { 
       this.txtphone.SuggestionsSource = stringArray2; 
      } 
相關問題