在银色指示灯中将默认值添加到ComboBox [英] Adding Default Value to ComboBox in silver light

查看:98
本文介绍了在银色指示灯中将默认值添加到ComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我写了Wcf Service来返回大学ID列表,并在Main.Xaml.cs文件中编写了事件处理程序,如下所示:

Hi,

I wrote Wcf Service for returning the university Id''s list and In Main.Xaml.cs file I Wrote Event Handler like Below:

ServiceReference1.WcfServiceClient client = new ServiceReference1.WcfServiceClient();
client.GetUnivIdListCompleted+=new EventHandler<GetUnivIdListCompletedEventArgs>(client_GetUnivIdListCompleted);
client.GetUnivIdListAsync();
void client_GetUnivIdListCompleted(object sender, GetUnivIdListCompletedEventArgs e)
        {
            cmbUniversity.ItemsSource = e.Result;        
        }


在上述cmbUniversity中,我的ComboBox名称是My ComboBox的名称,我将Wcf服务结果绑定到ComboBox的Itemsource属性.
现在,我必须在ComboBox中显示选择大学"文本.

我这样尝试过:


In Above cmbUniversity is My ComboBox name and I Binded Wcf service result to Itemsource property of ComboBox.

Now I have To Display "Select university" Text In ComboBox.

I tried like This:

cmbUniversity.Items.Insert(0,"Select university");


但是它不起作用.

请给我一些想法,如何插入该项目.

谢谢,
Vijay


But Its not working.

please Give me Some idea How To Insert That Item.

Thanks,
Vijay

推荐答案

选中此项 [ ^ ]可能帮助您


这篇关于在银色指示灯中将默认值添加到ComboBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆