h m

h m

  • NA
  • 235
  • 0

WebCam userControl has stopped working - WPF MVVM C#

Jul 30 2017 7:45 AM
I have multi view usercontrols which display by TebItems control.
 
One of TabItems contains my webcamdevice control which display web cam player using AForge. 
 
The problem is in load of usercontrol, video has stopped working. Just when I move or drag mouse or Click onto any textboxes field, then video will start to working. 
 
 
My Wecam.xaml:
 
<TextBox x:Name="TxtL2Name" Width="180" Validation.ErrorTemplate=" {x:Null}" Text=""/>  <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Width="1000" Height="600" VerticalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <video:WebcamDevice Grid.Row="0" Grid.Column="0" Margin="20,0,20,20" x:Name="CameraVideoDeviceControl" VideoPreviewWidth="Auto" VideoPreviewHeight="Auto" VideoSourceId="{Binding SelectedVideoDevice,                              Converter={StaticResource                              MediaInformationConverter}}" SnapshotBitmap="{Binding SnapshotBitmap,                              Mode=TwoWay}" /> </Grid> <Button x:Name="BtnSnapshot" Grid.Row="4" Margin="20,20,20,5" Grid.Column="0" Content="Take Snapshot"> <cmdBehavior:CommandBehaviorCollection.Behaviors> <cmdBehavior:BehaviorBinding Event="Click" Command="{Binding TakeSnapshot,                 ElementName=CameraVideoDeviceControl}" /> <cmdBehavior:BehaviorBinding Event="Click" Command="{Binding SnapshotCommand}" />`enter code here`         </cmdBehavior:CommandBehaviorCollection.Behaviors> </Button>

 
This is my Parent View: 
 
 
<ScrollViewer DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto"> <TabControl> <TabItem Header="VIEW1" Style="{StaticResource AzureTabItem}"> <TabControl> <view1:view1 /> </TabControl> </TabItem> <TabItem Header="CAMVIEW" Style="{StaticResource AzureTabItem}"> <TabControl> <Grid Margin="10"> <views:CamView/> </Grid> </TabControl> </TabItem> </TabControl> </ScrollViewer>

Answers (1)