Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <Viewbox Child="{StaticResource MyImageResourceKey}" Width="100" Height="100"/>
  2.  
  3. <ItemsControl ItemsSource="{Binding Images}">
  4. <ItemsControl.ItemTemplate>
  5. <DataTemplate>
  6. <Viewbox Width="100" Height="100">
  7. <ContentPresenter Content="{Binding Image}"/>
  8. </Viewbox>
  9. </DataTemplate>
  10. </ItemsControl.ItemTemplate>
  11. </ItemsControl>
  12.  
  13. public class ViewModelSomeWindow : INotifyPropertyChanged
  14. {
  15. public class MyImage
  16. {
  17. public object Image { get; set; }
  18. }
  19.  
  20. private ObservableCollection<MyImage> _images;
  21. public ObservableCollection<MyImage> Images
  22. {
  23. get { return _images; }
  24. set { _images = value; OnPropertyChanged(); }
  25. }
  26. ...
  27. }
  28.  
  29. Images.Add(new MyImage() { Image = App.Current.Resources["MyVectorImage"] });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement