2012-02-05 23 views
0

私はウェブカメラをキャプチャするために助けが必要です。私は初心者です、これは私がこれまで持っていたものです。WPFでウェブカメラを統合するには?

<ComboBox x:Name="camera" Grid.Row="1" Grid.Column="0" 
    ItemsSource="{Binding Source={x:Static WPFMediaKit:MultimediaUtil.VideoInputDevices}}" 
    DisplayMemberPath="Name" Foreground="Black" VerticalAlignment="Bottom" Margin="8.514,0,0,11.335"/> 

<StackPanel x:Name="camContainer" Grid.Row="2" Grid.Column="0" Width="320" Height="200" > 
<WPFMediaKit:VideoCaptureElement Name="video" LoadedBehavior="Play" DesiredPixelHeight="240" DesiredPixelWidth="320" Width="320" Height="240" 
VideoCaptureDevice="{Binding Path=SelectedItem, ElementName=videoCapDevices}" FPS="30"/> 
</StackPanel> 
+0

あなたは、C#のためのウェブカメラのドライバとそれのAPIを持っている(または.NET) –

答えて

0

あなたがnullにデバイスを設定しようとしていることを意味し、「videoCapDevices」

という名前の要素を持っているように見えるいけません。

、次の小さな変更が

<ComboBox x:Name="camera" Grid.Row="1" Grid.Column="0" 
    ItemsSource="{Binding Source={x:Static WPFMediaKit:MultimediaUtil.VideoInputDevices}}" 
    DisplayMemberPath="Name" Foreground="Black" VerticalAlignment="Bottom" SelectedItem="{Binding SelectedItem}" Margin="8.514,0,0,11.335"/> 

<StackPanel x:Name="camContainer" Grid.Row="2" Grid.Column="0" Width="320" Height="200" > 
<WPFMediaKit:VideoCaptureElement Name="video" LoadedBehavior="Play" DesiredPixelHeight="240" DesiredPixelWidth="320" Width="320" Height="240" 
VideoCaptureDevice="{Binding Path=SelectedItem}" FPS="30"/> 
</StackPanel> 
+0

ください(この端からテストされていない)働くかもしれあなたのviewmodel上のSelectedItemを持っていると仮定すると、 WPF Media Kitはデッドプロジェクトです。 –

関連する問題