0
我有一個列表框,其中包含每個項目都有組合框的項目列表。 在列表框中的項目中獲取組合框中的選定項目
我循環雖然列表框中的所有項目,我想爲我的列表框中的每個項目獲取組合框的選定項目。我怎樣才能做到這一點?
目前我怎麼取出來
private void StartConvertionButton_Click(object sender, RoutedEventArgs e)
{
RunNextVideo();
}
private void RunNextVideo()
{
var nextFile = viewModel.Files.Where(x => x.IsWorking == false).FirstOrDefault();
if(nextFile == null)
return;
DeviceQualityModel quality = (DeviceQualityModel) DeviceQualityComboBox.SelectedItem;
//Subtitle subtitle = nextFile
var test = FileListBox.Items;
VideoProcessing videoProcessing = new VideoProcessing(nextFile, ffmpegWrapper, viewModel, quality, new Subtitle());
videoProcessing.Done += VideoProcessingOnDone;
var thread = new Thread(videoProcessing.Run);
threads.Add(thread);
thread.Start();
}
這裏是我的WPF列表框
<ListBox Grid.Row="1" Margin="0,10,0,0" ItemsSource="{Binding Files, Mode=TwoWay}" x:Name="FileListBox" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="{Binding Filename}" FontSize="15" />
<StackPanel Orientation="Horizontal" >
<TextBlock Text="Width: " FontSize="12" />
<TextBlock Text="{Binding Width}" FontSize="12" />
<TextBlock Text=" Height: " />
<TextBlock Text="{Binding Height}" FontSize="12" />
</StackPanel>
<TextBlock Text="{Binding Path}" FontSize="9" />
<ComboBox ItemsSource="{Binding Subtitles, Mode=TwoWay}" Visibility="{Binding HaveSubtitles, Converter={StaticResource localVisibilityConverter}}" IsSynchronizedWithCurrentItem="True" SelectedIndex="1">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Language}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ProgressBar Height="10" IsIndeterminate="True" Visibility="{Binding IsWorking, Converter={StaticResource localVisibilityConverter}}" Width="Auto"/>
</StackPanel>
<Button Grid.Column="1" Margin="10,0,0,0" Click="RemoveButton_Click">Remove</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
這是「轉換」的方式......我不會看動畫:P –