c# - dxe:listbox not checking items -


im creating listbox (devexpress control) this

 <dxe:listboxedit x:name="lstboxfeatures" displaymember="description" valuemember="featureid" selectionmode="multiple"                                  itemssource="{binding path=datacontext.features, relativesource={relativesource ancestortype=window}}" height="320"                                                                       editvalue="{binding path=datacontext.selectedfeatures, relativesource={relativesource ancestortype=window}}"                                  >                     <dxe:listboxedit.stylesettings>                         <dxe:checkedlistboxeditstylesettings  />                         </dxe:listboxedit.stylesettings>                                                                   </dxe:listboxedit>          

i have view, fill filling values (are using list of features)

_customerlicense.features = getfeaturelist(selectedlicense.product.productid); _customerlicense.selectedfeatures =_customerlicense.features.where(x => featuresids.contains(x.featureid)).tolist(); 

the process ths list of features

   private list<feature> getfeaturelist(project.common.domain.productenum productid )     {         var res = new list<feature>();         var features = new licenseservice().getfeatures(productid);         features.foreach((x)=> {             res.add(new feature(x));         });         return res;     }  

the view have way

 public list<feature> features     {         { return _features;}         set         {             _features = value;             this.notifypropertychanged("features");         }     }           public list<feature> selectedfeatures     {         { return _selectedfeatures; }         set         {             _selectedfeatures = value;             notifypropertychanged("selectedfeatures");         }     } 

when run app sets values, listbox populated reatures in list selected features not checked. regards

the selectedfeatures collection should contain subset of feature instances in features collection. try this:

var features = getfeaturelist(selectedlicense.product.productid); _customerlicense.features = features;  var selectedfeatureids = _customerlicense.features.where(x => featuresids.contains(x.featureid)).select(x => x.featureid).tolist(); _customerlicense.selectedfeatures = features.where(x => selectedfeatureids.contains(x.featureid)).tolist(); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -