'How do I record the contents of a usercontrol in my WPF app?
I have a WPF app that uses a UserControl box, rather than a regular image container to display the live feed of a connected camera. The camera is not a standard webcam, rather a high fidelity lab camera used to capture stuff in high frame rates. Hence, the use of a UserControl. I want to record the video of the camera and save the recording to my computer, however, all previous mentions of camera recording have been with a webcam and nothing to do with a usercontrol.
The following code is the logic behind my Start Recording button.
private void btnRecordCapture_Click(object sender, RoutedEventArgs e)
{
var dialog = new SaveFileDialog();
dialog.FileName = "Video1";
dialog.DefaultExt = "avi";
var dialogresult = dialog.ShowDialog();
if (dialogresult != true)
{
return;
}
_writer = new VideoFileWriter();
_writer.Open(dialog.FileName, (int)Math.Round(videoWindow1.Width, 0), (int)Math.Round(videoWindow1.Height, 0));
_recording = true;
}
This is what I attempted. Please note that videoWindow1 is the name of the UserControl on my MainWindow.xaml file. In the place of videoWindow1, I want to call the actual userControl and its contents. However, Im not sure how to do it, or even if it is the correct way of going about it.
Any help would be greatly appreciated.
Kind Regards
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
