WPF新建线程覆盖窗口的进度条

该博客介绍了如何在WPF中创建一个覆盖窗口的进度条,包括无计数和带计数两种展示方式,并提供了进度窗口的XAML代码示例。
摘要由CSDN通过智能技术生成

先来看一下效果图,这个是没有计数的进度条



这个是带计数的进度条



进度条的封装,首先是进度窗口的xaml代码

<Window x:Class="System.Windows.Controls.ProgressBarWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Name="window" ShowInTaskbar="False"
        WindowStartupLocation="Manual" WindowStyle="None"  
        Background="Transparent" AllowsTransparency="True">
    <Grid>
        <Border Background="White" Opacity="0.7" CornerRadius="10 10 10 10" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding ElementName=window,Path=Text}" FontSize="15"
                               Margin="80 5 80 5"
                               TextWrapping="Wrap" TextAlignment="Center"/>
                    <ProgressBar Margin="80,5,80,5" Height="25" Grid.Row="1"
                         IsIndeterminate="{Binding ElementName=window,Path=IsIndeterminate}" 
                         Value="{Binding ElementName=window,Path=Value}"
                         Maximum="{Binding ElementName=window,Path=Maximum}"/>
                    <Button Grid.Row="2" MaxWidth="120" Click=&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值