<Grid Name="LayoutRoot">
<Grid.DataContext>
<MyModel SelectedItem={Binding DataContext, ElementName=MyControl}>
</Grid.DataContext>
...
var view = new ListView();
view.ItemTemplate = new DataTemplate();
view.ItemContainerStyle = new Style() { ... };
<Image Source="{Binding CurrentImage}" >
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Image.Opacity)" From="0" To="1" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<Button Content="Next image" MouseLeftButtonDown="NextImageClick"/>
public BitmapImage CurrentImage { get; set; }
public List<BitmapImage> Images { get; set; }
private int _imageIndex = 0;
public void NextImageClick(object sender, MouseButtonEventArgs e)
{
if (_imageIndex >= Images.Count) _imageIndex = 0;
CurrentImage = Images[imageIndex];
RaisePropertyChanged("CurrentImage"); //необходимо реализовать INotifyPropertyChanged в классе модели
_imageIndex++;
}
<UserControl x:Class="..."
...
xmlns:res="clr-namespace:<namespace_проекта>.Properties"
...
<Image Source="{x:Static res:Resources.<имя_ресурса>}" />