Skip to content

Instantly share code, notes, and snippets.

@odugen
Created April 14, 2014 06:54
Show Gist options
  • Select an option

  • Save odugen/10622541 to your computer and use it in GitHub Desktop.

Select an option

Save odugen/10622541 to your computer and use it in GitHub Desktop.
ComboBox ItemsSource to parent collection binding
<!-- In user countrol resources -->
<UserControl.Resources>
<CollectionViewSource Source="{Binding Currencies}" x:Key="Currencies"/>
</UserControl.Resources>
<!-- below inside ex. DataGrid -->
<ComboBox ItemsSource="{Binding Source={StaticResource Currencies}}" IsSynchronizedWithCurrentItem="False"
DisplayMemberPath="IsoCode"
SelectedItem="{Binding BaseCurrency}"/>
<!-- IsSynchronizedWithCurrentItem="False" is important, otherwise ComboBoxes will select same item for each child viewmodel -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment