none
ListBox绑定的项没有办法选择 RRS feed

  • 问题

  • “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”控件绑定没有问题,但是绑定之后没有办法选择其中的项???为什么???     怎么回事???

    用“Silverlight   Toolkit”下的“ListBox”控件则是没有问题的,XAML如下:

    <ListBox Name="tlb_BuildingFunc"  SelectedValuePath="DpCodeId"  DisplayMemberPath="DpCodeName" SelectionMode="Multiple"/>


    Science and technology is my lover.


    2012年5月28日 11:20

答案