当ProgressBar执行步骤时,ListBoxItem结果不可点击

时间:2018-04-05 06:40:51

标签: c# xaml click progress-bar listboxitem

我有一个DataTemplate,用于描述XAML中ListBox的项目。在每个项目中,我有四件事:

1)进度条

2)三个按钮

我注意到当进度条前进时,按钮会导致无法点击,为什么?

我的XAML代码引用了上面提到的ListBox:

    <ListBox Grid.Column="1" Name="TransfersList" Margin="30,10,-0.444,34.889" ItemsSource="{Binding DataTx}"
             SelectionChanged="TransfersList_SelectionChanged" Grid.Row="1" Grid.ColumnSpan="3"
             HorizontalContentAlignment="Stretch">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <ProgressBar Height="20" Minimum="0" Maximum="{Binding NChunks}" Name="gasparino_il_carbonaro"
                                 Value="{Binding PbStatus}" Foreground="{Binding Color}"
                                 ToolTip="{Binding TooltipInfo}" />
                    <Button Content="Delete all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
                            VerticalAlignment="Center" HorizontalAlignment="Left" Width="75" Background="White"
                            Click="DeleteAllTransfersClick" />
                    <Button Content="Stop all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
                            VerticalAlignment="Center" HorizontalAlignment="Center" Width="75" Background="White"
                            Click="StopAllTransfersClick" />
                    <Button Content="Resume all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
                            VerticalAlignment="Center" HorizontalAlignment="Right" Width="75" Background="White"
                            Click="ResumeAllTransfersClick" />
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

1 个答案:

答案 0 :(得分:0)

它发生在单线程应用程序中。要使用多线程概念,请使用event&amp; amp;显示进度条。代表。