如何设置选择的组合框的第一个元素 [英] How Can I Set The First Element Of Combobox Selected

查看:160
本文介绍了如何设置选择的组合框的第一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的wpf项目中有一个组合框.

Hi,

i have a combobox in my wpf project.

<ComboBox SelectedValue="{Binding Path=GroupId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="GroupId" DisplayMemberPath="GroupName" Height="23" HorizontalAlignment="Left" Margin="683,237,0,0" Name="SecurityGroupComboBox" VerticalAlignment="Top" Width="181" FontSize="10.667" />


我用下面的集合填充它


i populated it with collection like below

ObservableCollection<SecurityGroupsBO> collection = securityGroupDAL.FetchSecurityGroups();



我使用了SecurityGroupComboBox.selectedindex = 0;

但没有选择第一项

请帮帮我吗?



i used SecurityGroupComboBox.selectedindex=0;

but the first item not selected

please help me?

推荐答案

你好,
试试这个: WPF ComboBox初始选择
谢谢
Hello ,
Try this one : WPF ComboBox initial selection
thanks


这篇关于如何设置选择的组合框的第一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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