I'm trying to add a dynamic Image in my WPF form. I've added the Image like this:
<Image Height="212" HorizontalAlignment="Left" Margin="12,167,0,0"
Name="picture_scan" Stretch="Fill" VerticalAlignment="Top" Width="227"
Source="{Binding FingerprintSource}" />
The source leads to the following code in my service class:
public BitmapSource FingerprintSource
{
get { return fingerprintScan.WpfImageSource; }
}
The WpfImageSource
is a BitmapSource
. As I said, the Image is dynamic. Through an event from my Fingerprint Reader, the following code is called:
private void HandleFingerprintObtainedEvent(Fingerprint fingerprint, FingerprintImage fingerprintImage)
{
Debug.WriteLine("New fingerprint found!");
fingerprintScan = fingerprintImage;
}
When I run the program and press my finger on the reader, a new fingerprint image is found. The value fingerprintScan
is being changed. But the problem is, before and after putting my finger on the scanner, the bitmap is empty (white?). What am I doing wrong? Do I need to do more besides databinding, like checking for events or something? Is it a problem when the source of the databinding is a BitmapSource
instead of a BitmapImage
?