0

I've got a Windows 8 Store form with multiple controls, a.o. lots of comboboxes, 2 I show below. I can populate them using databinding to a number of ObservableCollections (most used in multiple comboboxes, like prMachType). This works to databind the content to display.

    <ComboBox x:Name="machinetype" ItemsSource="{Binding prMachtype}" SelectedItem="{Binding SelectedClass, Mode=TwoWay}" />

However I am not sure how to get the results of the controls the user enters into another ObservableCollection. The 'set' below is called (only when I add Mode=TwoWay in the XAML) when I change a value in the combobox machinetype:

public SchwDescr SelectedClass
{
    get
    {
        return _SelectedClass;
    }
    set
    {
        if (_SelectedClass != value)
        {
            _SelectedClass = value;
            RaisePropertyChanged("SelectedClass");
        }
    }
}

_SelectedClass contains the properties of the assigned ObservableCollection (like Description and Key) but now I would need to have this key (e.g. "00005") and field used (machinetype, as in the name of the combobox) together to store in another ObservableCollection (containing Field + Key, so machinetype and "00005" when this combobox is selected. I do not see which control (here combobox machinetype) the user is changing here so I can't store the field+selection 'manually' and I also don't see how I can databind directly to such an ObservableCollection so key+field are update directly and also show the (stored) selection when I load the data again (the preferred way of course).

Can someone lead me to the right direction (like a full sample)?

Dick
  • 433
  • 5
  • 13
  • Look it here I think it is what you need http://stackoverflow.com/questions/561166/binding-wpf-combobox-to-a-custom-list – Dave Jun 21 '14 at 13:48
  • 1
    You need to get familiar with WFP. Books and WWW. I think you are looking for a master detail. http://msdn.microsoft.com/en-us/library/ms752347(v=vs.110).aspx – paparazzo Jun 21 '14 at 13:49

0 Answers0