2

我正在为我的 GUI 使用 C# 和 WPF。我的目标是在 wpf 弹出控件下显示一个进度条。我正在使用下面的代码在弹出控件下添加一个进度条。

<Popup HorizontalAlignment="Left" Margin="338,261,0,0" Name="popup1" VerticalAlignment="Top" Height="38" Width="153" >
            <StackPanel Background="Red">
                <ProgressBar Height="15" HorizontalAlignment="Left" Margin="349,272,0,0" Name="progressBar1" VerticalAlignment="Top" Width="130" Foreground="#FF3EA3EA" Value="{Binding ElementName=textBox1, Path=Text.Length, Mode=OneTime}"   Maximum="140" />

            </StackPanel>
        </Popup>

请帮我。

感谢先进!

4

1 回答 1

4

您应该使用以下代码ProgressBarPopup控件下显示:

<Popup Name="popup1" HorizontalAlignment="Left" Margin="338,261,0,0" AllowsTransparency="True" VerticalAlignment="Top" Height="38" Width="153">
    <Grid>
        <ProgressBar HorizontalAlignment="Left"   
                     Name="progressBar1" Height="25" 
                     VerticalAlignment="Center" Width="130" 
                     Foreground="#FF3EA3EA" 
                     Value="{Binding ElementName=textBox1, Path=Text.Length, Mode=OneTime}"
                     Maximum="140" ForceCursor="False" />
    </Grid>
</Popup>
于 2013-08-13T08:26:04.040 回答