C # / WPF: Wiązanie Combobox ItemSource w Datagrid do elementu poza DataContext
Chciałbym wykonać następujące czynności:
public List<Users> PreLoadedUserList { get; set; }
public List<RowEntries> SomeDataRowList { get; set; }
public class Users
{
public int Age { get; set; }
public string Name { get; set; }
}
public class SomeDataRowList
{
public int UserAge { get; set;
}
Teraz moja (WPF Toolkit) DataGrid wygląda tak:
<my:DataGrid AutoGenerateColumns="False" MinHeight="200"
ItemsSource="{Binding Path=SomeDataRowList}">
<my:DataGridComboBoxColumn Header="Age"
ItemsSource="{Binding Path=PreLoadedUserList}"
DisplayMemberPath="Name"
SelectedValueBinding="{Binding Path=UserAge}"/>
</my:DataGrid>
Teraz mój problem polega na tym, że PreLoadedUserList znajduje się poza ItemSource (SomeDataRowList) i nie wiem, jak powiązać się z czymś poza nim. Co właściwie chcę: - Wyświetl w ComboBox PreLoadedUserList - Ustaw wartość (RowEntries) SelectedItem.UserAge na wartość wybranego ComboboxItem.Age
Daj mi znać, jeśli moje wyjaśnienie jest zbyt dziwne :-)
Dziękuję, okrzyki