How to link to CurrentItem ICollectionView

I want a property for the current item ICollectionView, how can I do this? ICollectionViewused to bind to a combo box, how can I bind another control to an item ICollectionView?

+5
source share
3 answers

Check out this cheat sheet . In particular, check the anchor character /that refers to the current item in the collection view.

+8
source

IsSynchronizedWithCurrentItem ComboBox ( , ). :

<ComboBox ItemsSource="{Binding Names}" IsSynchronizedWithCurrentItem="True" />
<Button Content="{Binding Path=Names/}"/>
+6

Give your ComboBox a name and bind SelectedItem to it.

For instance:

<ComboBox x:Name="MyComboBox" ItemsSource="{Binding MyList}" />

<Grid DataContext={Binding ElementName=MyComboBox, Path=SelectedItem>
...
</Grid>
+2
source

All Articles