ListBox绑定的项没有办法选择
“Telerik”下“ListBox”绑定了“数据源”,但是其中的项没有办法选择。绑定后的ListBox控件如下图:
XAML如下:
<telerik:ListBox Name="tlb_BuildingFunc" SelectedValuePath="DpCodeId" DisplayMemberPath="DpCodeName" SelectionMode="Multiple" SelectedIndex="0" />
后台.Cs代码:
private void BindBaseDatas()
{
string weburl = Application.Current.Host.Source.ToString();
weburl = weburl.Substring(0, (weburl.Length - 23)) + "/ChartsService.svc";
MyChartsService.ChartsServiceClient client = new MyChartsService.ChartsServiceClient("CustomBinding_ChartsService1", weburl);
client.GetCodeDetailsEntityDataAsync("BldingFunction");
client.GetCodeDetailsEntityDataCompleted += new EventHandler<MyChartsService.GetCodeDetailsEntityDataCompletedEventArgs>(client_GetCodeDetailsEntityDataCompleted);
}
void client_GetCodeDetailsEntityDataCompleted(object sender, MyChartsService.GetCodeDetailsEntityDataCompletedEventArgs e)
{
ObservableCollection<MyChartsService.CodeDetailsEntity> regions = e.Result;
tlb_BuildingFunc.ItemsSource = e.Result;
}
问题:“ListBox”控件绑定没有问题,但是绑定之后没有办法选择其中的项???为什么??? 怎么回事???
[解决办法]
listbbox.Items[i]……不行吗
[解决办法]
没有办法选取,应该是Telerik的问题,跟listbox 应该没关系。建议楼主查查 Telerik 的相关资料。
[解决办法]