Wpf 显示System.Controls.Image当前项的主详细信息时出现问题

Wpf 显示System.Controls.Image当前项的主详细信息时出现问题,wpf,wpf-controls,binding,Wpf,Wpf Controls,Binding,我试图在标签中显示照片对象的名称,但我正在特定的控制系统中显示此照片。Windows.Image,此控件绑定到照片集合的CurrentItem,因此如果我有一个按钮显示下一张照片,我希望在标签中显示照片的名称集合的CurrentItem!!!!或者该元素中的另一个属性 <Image Margin="0,0,5,0" Grid.Column="0" Grid.Row="0" Na

我试图在标签中显示照片对象的名称,但我正在特定的控制系统中显示此照片。Windows.Image,此控件绑定到照片集合的CurrentItem,因此如果我有一个按钮显示下一张照片,我希望在标签中显示照片的名称集合的CurrentItem!!!!或者该元素中的另一个属性

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
公开课照片 { 姓名; 位图帧图像

    public Photo(string path)
    {
        Name = path;
        _image = BitmapFrame.Create(_source);
    }

    public BitmapFrame ImageFrame { get { return _image; } set { _image = value; } }
 }
        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
公共部分类ImageViewer:窗口 { int currentIndex=0; 可观察收集照片

    public ImageViewer()
    {
        InitializeComponent();

        photos = new ObservableCollection<Photo>();

        Photo photo1 = new Photo(@"C:/Users/.../DSC00700.jpg");
        Photo photo2 = new Photo(@"C:/Users/../DSC00581.jpg");
        Photo photo3 = new Photo(@"C:/Users/../3882_6.jpg");

        photos.Add(photo1);
        photos.Add(photo2);
        photos.Add(photo3);

        this.DataContext = photos;
    }

    private void NextPhoto(object sender, RoutedEventArgs e)
    {
        currentIndex++;
        if (currentIndex == photos.Count)
            currentIndex = 0;
        image.Source = photos[currentIndex].ImageFrame;
    }
        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
}

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
xaml代码:

        <Image 
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="Fill" 
            DataContext ="{Binding /}"
            Source="{Binding ImageFrame}"
         >
        </Image>

        <TextBlock 
            DataContext="{Binding ElementName=image, Path=DataContext}"
            Text="{Binding Name}">
         </TextBlock>
        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
问候 伊万

XMAL:
        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
反恐精英: 使用制度; 使用System.Collections.Generic; 使用System.Collections.ObjectModel; 使用System.Linq; 使用系统文本; 使用System.Windows; 使用System.Windows.Controls; 使用System.Windows.Data; 使用System.Windows.Documents; 使用System.Windows.Input; 使用System.Windows.Media; 使用System.Windows.Media.Imaging; 使用System.Windows.Navigation; 使用System.Windows.Shapes

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
命名空间WpfApplication2 { /// ///MainWindow.xaml的交互逻辑 /// 公共部分类主窗口:窗口 { 私有字符串photosDir=@D:\Users\Rafael\Gaby\Fotos\5 x 7; 私人可观测采集照片=新可观测采集

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>
    public static DependencyProperty SelectedPhotoIndexProperty = DependencyProperty.Register("SelectedPhotoIndex", typeof(double), typeof(MainWindow));
    public static DependencyProperty SelectedPhotoProperty = DependencyProperty.Register("SelectedPhoto", typeof(Photo), typeof(MainWindow));

    public MainWindow()
    {
        InitializeComponent();

        foreach(var curImg in System.IO.Directory.GetFiles(this.photosDir))
            photos.Add(new Photo(curImg));

        if(photos.Count > 0)
        {
            this.scbImages.Maximum = photos.Count - 1;
            this.SelectedPhotoIndex = 0;
        }
    }

    public double SelectedPhotoIndex
    {
        get
        { return this.GetValue(SelectedPhotoIndexProperty) != null ? (double)this.GetValue(SelectedPhotoIndexProperty) : 0; }
        set
        { 
            this.SetValue(SelectedPhotoIndexProperty, value);
            this.SelectedPhoto = photos[(int)value];
        }
    }
    public Photo SelectedPhoto
    {
        get { return this.GetValue(SelectedPhotoProperty)as Photo; }
        set
        {
            this.SetValue(SelectedPhotoProperty, value);
        }
    }

    private void scbImages_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
        this.SelectedPhotoIndex = (int)e.NewValue;
    }
}

public class Photo
{
    public Photo(string path)
    {
        Name = path;
        ImageFrame = BitmapFrame.Create(new Uri(path));
    }

    public string Name
    { get; set; }
    public BitmapFrame ImageFrame { 
        get;
        set;
    }
}
}

        <Image 
            Margin="0,0,5,0"
            Grid.Column="0"
            Grid.Row="0"
            Name="image"
            Stretch="UniformToFill" 
            DataContext ="{Binding SelectedPhoto, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dns:MainWindow}}}"
            Source="{Binding ImageFrame}" HorizontalAlignment="Center" VerticalAlignment="Center">
        </Image>
        <ScrollBar Height="20" Name="scbImages" Orientation="Horizontal" Grid.Column="0"
            Grid.Row="1" Maximum="0" SmallChange="1" ValueChanged="scbImages_ValueChanged" />

        <GroupBox Name="info" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
            <GroupBox.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Name: "/>
                        <Label DataContext="{Binding Path=DataContext, ElementName=image}" Content="{Binding Name}"></Label>
                    </StackPanel>
                </DataTemplate>
            </GroupBox.HeaderTemplate>
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <StackPanel DataContext="{Binding Path=Metadata, ElementName=image}">
                    <Label>Size:</Label>
                    <Label Content="{Binding}"></Label>
                    <Label >Date Image Taken:</Label>
                    <Label Content="{Binding DateImageTaken}" />
                    <Label >Camera Model:</Label>
                    <Label Content="{Binding CameraModel}"/>
                    <Label >Creation Software:</Label>
                    <Label Content="{Binding CreationSoftware}" />
                    <Label >Lens Aperture:</Label>
                    <Label Content="{Binding LensAperture}" />
                    <Label >Focal Length:</Label>
                    <Label Content="{Binding FocalLength}" />
                    <Label >ISO Speed:</Label>
                    <Label Content="{Binding IsoSpeed}" />
                    <Label >Exposure Time:</Label>
                    <Label Content="{Binding ExposureTime}" />
                    <Label >Exposure Mode:</Label>
                    <Label Content="{Binding ExposureMode}" />
                    <Label >Exposure Compensation:</Label>
                    <Label Content="{Binding ExposureCompensation}" />
                    <Label >White Balance Mode:</Label>
                    <Label Content="{Binding WhiteBalanceMode}" />
                    <Label >Color Representation:</Label>
                    <Label Content="{Binding ColorRepresentation}" />
                </StackPanel>
            </ScrollViewer>
        </GroupBox>
    </Grid>
</Grid>