private void device_OnNewBitmapReady(object sender, EventArgs e)
{
// Create new binding for the framerate
Binding b = new Binding();
b.Source = Device;
b.Path = new PropertyPath(CapDevice.FramerateProperty);
SetBinding(FramerateProperty, b);
// Get the sender
CapDevice typedSender = sender as CapDevice;
if (typedSender != null)
{
// Set the source of the image
Source = typedSender.BitmapSource;
}
}