silverlight 中的busyIndicator 加载控件

XAML代码

<UserControl x:Class="SilverlightApplication9.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="598" d:DesignWidth="825" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">

    <Grid x:Name="LayoutRoot" Background="White" Height="528" Width="743">
        <Canvas Height="506" HorizontalAlignment="Left" Margin="10,10,0,0" Name="canvas1" VerticalAlignment="Top" Width="733">
            <TextBox Canvas.Left="185" Canvas.Top="36" Height="157" Name="textBox1" Width="301" />
            <Button Canvas.Left="293" Canvas.Top="264" Content="填入数据" Height="23" Name="button1" Width="75" Click="button1_Click" />
          
        </Canvas>
        <Canvas Canvas.Left="10" Canvas.Top="10" Name="canvas2" Margin="13,19,0,0"  Background="White" Visibility="Collapsed">
                <toolkit:BusyIndicator Canvas.Left="207" Canvas.Top="211" Height="95"  Name="busyIndicator1" Width="304" BusyContent="正在加载数据,请稍后!" IsBusy="False" />
            </Canvas>
    </Grid>
</UserControl>

 

CS代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Threading;

namespace SilverlightApplication9
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

            busyIndicator1.IsBusy = true;
            textBox1.Text = "123333333333333333333333333333333334566666666666666";
            canvas2.Visibility = Visibility.Visible;
            ThreadPool.QueueUserWorkItem((threadState) =>
            {
                Thread.Sleep(5000);
                Dispatcher.BeginInvoke(() =>
                 canvas2.Visibility = Visibility.Collapsed);
                Dispatcher.BeginInvoke(() =>
                              busyIndicator1.IsBusy = false);
            });
        }
    }
}

 实例下载http://download.csdn.net/detail/bychentufeiyang/3914725

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值