Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Listbox with DataTemplate containing a Combobox - Binding problem

$
0
0

Hello everybody,

I've a litte problem with my ListBox and the databinding and hope somebody can help me:

When I change the value of one Combobox, all other boxes changes as well

<Page.Resources><CollectionViewSource x:Key="typen"  /></Page.Resources><ListBox Name="list_positionen"><ListBox.ItemTemplate><DataTemplate><ComboBox DisplayMemberPath="name" SelectedValuePath="id" SelectedValue="{Binding Path=merkmaltyp}" ItemsSource="{Binding Source={StaticResource typen}}" /></DataTemplate></ListBox.ItemTemplate></ListBox>

code behind sets the source of "typen" and adds some items to the list:

var qry = from a in sql.tbl_typ
          orderby a.name
          select a;
(this.FindResource("typen") as CollectionViewSource).Source = qry;


foreach (tbl_list list in data.tbl_list
{
 list_positionen.Items.Add(list);
}

I need to change each listbox-item to different combobox values.

Big thanks!









Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>