This is the working solution, however when selection changes SelectedItemsProperty does not refresh bindings...
you can create a custom control as follow
public class MyListBox: ListBox{
public MyListBox()
{
this.SelectionChanged += (s,e)=>{ RefreshBindings(); };
}
private void RefreshBindings()
{
BindingExpression be =
(BindingExpression) GetBindingExpression(
SelectedItemsProperty);
if(be!=null){
bd.UpdateTarget();
}
}
}
or in your app you can define event in every listbox as shown below ..
myListBox.SelectionChanged += (s,e) => {
BindingExpression be =
(BindingExpression) myListBox.GetBindingExpression(
ListBox.SelectedItemsProperty);
if(be!=null){
bd.UpdateTarget();
}
};