简体   繁体   English

如何在Windows Phone 8.1应用程序中的ComboBox中搜索项目?

[英]How to Search Items in ComboBox in Windows Phone 8.1 App?

I am developing windows phone app.In my combobox so many items are there.Now I want to search item in combobox.whenever I click combobox, items are displayed but not show any search textbox. 我正在开发Windows Phone应用程序。在我的组合框中有很多项目。现在我要在组合框中搜索项目。每当我单击组合框时,项目都会显示但不显示任何搜索文本框。

<Button x:Name="btn1"  Content="submit"  Click="btn1_Click"></Button>
        <Popup x:Name= "Pop" IsOpen="False">
            <Grid>
  <TextBox x:Name= "SearchText box"/>
                <ListBox HorizontalAlignment="Left" Width="399" Margin="0,0,-348,-524" x:Name="Listbox1">
                <ListBox.ItemTemplate>

                        <DataTemplate>
                            <TextBlock Text="{Binding yourdata}"></TextBlock>
                        </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
        </Popup>

Actually what happend is in my combobox having somany cities names,now I want to perticuler city name.how to get perticular city name,how to search.pllease hellp me. 实际上,发生在我的组合框中的城市名称非常多,现在我要细化城市名称。如何获取特定的城市名称,如何搜索。请打扰我。 in my code page 在我的代码页中

      public async void getdata()
                {
                    var client = new NewReloadApp.JsonWebClient();

                    var resp1 = await client.DoRequestAsync(Url.weburl + "getRechargeCircleList");

                    string result1 = resp1.ReadToEnd();
                    JArray jsonArray = JArray.Parse(result1);

                    for (int j = 0; j < jsonArray.Count; j++)
                    {
                        JObject jobj = (JObject)jsonArray[j];

                        string id = (string)jobj["CircleID"];
                        string statename = (string)jobj["CircleName"];

                                 listbox1.items.add(statename );
}
    }

but listbox1 not shown 但是listbox1没有显示

Combobox does not allow to search from ComboboxItem Combobox不允许从ComboboxItem搜索

Please use another control to search functionality or create your own control like using Popup controll and put Listbox in it and bind your data. 请使用另一个控件来搜索功能或创建自己的控件(例如使用Popup控件),然后将Listbox放入其中并绑定数据。 then add search textbox & search from listbox 然后添加搜索文本框并从列表框搜索

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM