If I have two objects, one being the list of items, and the other having a property storing the selected item of the other list, is it possible to update the selected item through binding in WPF?
Lets say I have these two data structures:
public class MyDataList { public ObservableCollection<Guid> Data { get; set; } } public class MyDataStructure { public Guid ChosenItem { get; set; } }
Is it possible to bind a Listbox to an instance of both objects so that the ChosenItem property gets set by the selected item of the ListBox?
EDIT: To make things a bit clearer, there might be many instances of MyDataStructure, each with a chosen item from MyDataList. The data list is common to all the instances, and I need a way to select an item and store that selection in the MyDataStructure.
I believe you should be able to do this (make sure to declare the local namespace):