i have a dictonary
public class TAGs :INotifyPropertyChanged{
private Dictionary<string, string[]> _items = new Dictionary<string,string[]>();
...............
public string[] Keys
{
get { return Items.Keys.ToArray(); }
}
}
i want to create 2 list, 1 list for the key and the other list contain the values of the selected keys, i tried this but it doesnt work
<ListBox x:Name="TagNameList" ItemsSource="{Binding Keys}"/>
<ListBox ItemsSource="{Binding Items[{Binding SelectedItem,ElementName=TagNameList}]}"/>
i contained them to a grid and their datacontext is an object of TAGs, the 1st listbox is working fine as its simple binding to a property but the 2nd list, isnt working
any help?
"{Binding Items[{Binding SelectedItem,ElementName=TagNameList}]}"isn’t valid xaml. You can’t do a binding inside a path since the path is constructed at compile time.When encountering this myself I’ve simply ended up binding something else to the
SelectedItemof oneListBoxand then when that gets notified of a change, also fire aNotifyPropertyChangedon another property exposingItems[selectedKey]to which my secondListBoxis bound.xaml:
C#: