Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <ListBox x:Name="listbox" ItemsSource="{Binding StringList}" SelectionMode="Multiple"/>
  2. <Button Command="{Binding GetListItemsCommand}" CommandParameter="{Binding SelectedItems, ElementName=listbox}" Content="GetSelectedListBoxItems"/>
  3.  
  4. xmlns:i="http://schemas.microsoft.com/expression//2010/interactivity"
  5. xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
  6.  
  7. <GridView x:Name="GridName">
  8. <i:Interaction.Triggers>
  9. <i:EventTrigger EventName="SelectionChanged">
  10. <i:InvokeCommandAction Command="{Binding Datacontext.SelectionChangedCommand, ElementName=YourUserControlName}" CommandParameter="{Binding SelectedItems, ElementName=GridName}" />
  11. </i:EventTrigger>
  12. </i:Interaction.Triggers>
  13.  
  14. public DelegateCommand<object> SelectionChangedCommand {get;set;}
  15.  
  16. SelectionChangedCommand = new DelegateCommand<object> (items => {
  17. var itemList = (items as ObservableCollection<object>).Cast<YourDto>().ToList();
  18. }
  19.  
  20. // Your goes heres
  21.  
  22. // Your goes heres
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement