繁体   English   中英

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

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

我正在开发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>

实际上,发生在我的组合框中的城市名称非常多,现在我要细化城市名称。如何获取特定的城市名称,如何搜索。请打扰我。 在我的代码页中

      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 );
}
    }

但是listbox1没有显示

Combobox不允许从ComboboxItem搜索

请使用另一个控件来搜索功能或创建自己的控件(例如使用Popup控件),然后将Listbox放入其中并绑定数据。 然后添加搜索文本框并从列表框搜索

暂无
暂无

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

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