写在之前:

关于WPF的样式,我也是学习了很多朋友的文章才有了下面的东西,因为时间有些久远 & 备份的链接也都不在了。

所以,究竟是看过哪些文章,也是记不清楚了……

请见谅。

--------------------------------我是害羞的分割线-----------------------------------

先看一下效果吧……

主要是xaml,因为ProssBar基本上市公用的,所以封装成一个控件:

<UserControl x:Class="AppHost.ProBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="20" d:DesignWidth="500" Background="Transparent">
<UserControl.Resources>
<Storyboard x:Key="StoryLeftToRight" RepeatBehavior="Forever">
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e1" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="30,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:00.6" Value="225,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:03.1" Value="275,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:03.7" Value="500,0,0,0"/>
</ThicknessAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e2" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.5" Value="20,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01.1" Value="225,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:03.6" Value="275,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:04.2" Value="490,0,0,0"/>
</ThicknessAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e3" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:01.0" Value="10,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01.6" Value="225,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:04.1" Value="275,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:04.7" Value="480,0,0,0"/>
</ThicknessAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="e4" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:01.5" Value="0,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:02.1" Value="225,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:04.5" Value="275,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:05.2" Value="470,0,0,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Style x:Key="EllipseLeftStyle" TargetType="Ellipse">
<Setter Property="Width" Value="4"/>
<Setter Property="Height" Value="4"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Fill" Value="#FF2CB6E7"/>
</Style>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource StoryLeftToRight}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Ellipse Style="{StaticResource EllipseLeftStyle}" Margin="30,0,0,0" Name="e1"/>
<Ellipse Style="{StaticResource EllipseLeftStyle}" Margin="20,0,0,0" Name="e2"/>
<Ellipse Style="{StaticResource EllipseLeftStyle}" Margin="10,0,0,0" Name="e3"/>
<Ellipse Style="{StaticResource EllipseLeftStyle}" Margin="0,0,0,0" Name="e4"/>
</Grid>
</UserControl>

在使用中的时候直接在 xaml中写:

<local:ProBar x:Name="proBar"  HorizontalAlignment="Center"  VerticalAlignment="Center" Width="507"/>

local是Probar所在NameSpacce.

WPF进度条系列①滑动小圆点的更多相关文章

  1. WPF进度条系列②旋转小圆圈

     写在之前: 关于WPF的样式,我也是学习了很多朋友的文章才有了下面的东西,因为时间有些久远 & 备份的链接也都不在了. 所以,究竟是看过哪些文章,也是记不清楚了…… 请见谅. ------- ...

  2. 疯狂JAVA讲义---第十二章:Swing编程(五)进度条和滑动条

    http://blog.csdn.net/terryzero/article/details/3797782 疯狂JAVA讲义---第十二章:Swing编程(五)进度条和滑动条 标签: swing编程 ...

  3. WPF 进度条ProgressBar

    今天研究了一下wpf的进度条ProgressBar 1.传统ProgressBar WPF进度条ProgressBar 这个控件,如果直接写到循环里,会死掉,界面会卡死,不会有进度.需要把进度条放到单 ...

  4. 使用原生JS+CSS或HTML5实现简单的进度条和滑动条效果(精问)

    使用原生JS+CSS或HTML5实现简单的进度条和滑动条效果(精问) 一.总结 一句话总结:进度条动画效果用animation,自动效果用setIntelval 二.使用原生JS+CSS或HTML5实 ...

  5. WPF进度条

    ProgressBar控件与传统WinForm使用方法完全一样,我们只需关注: Minimum——最小值,默认为0: Maximum——最大值,默认为100. Value——当前值.   关键是它的控 ...

  6. 继续聊WPF——进度条

    ProgressBar控件与传统WinForm使用方法完全一样,我们只需关注: Minimum——最小值,默认为0: Maximum——最大值,默认为100. Value——当前值.   关键是它的控 ...

  7. C# WPF 进度条,根据读取数据显示进度条进度,根据Excel文件读取数据,进度条样式

    后台代码: //导入 private void Border_MouseLeftButtonUp_2(object sender, MouseButtonEventArgs e) { var path ...

  8. wpf 进度条 下拉

    <Window x:Class="WpfApplication1.MainWindow"        xmlns="http://schemas.microsof ...

  9. 第三方MMDrawerController的使用 抽屉视图+(SUNSlideSwitchView)进度条手势滑动效果实现

    下载网站:https://github.com/mutualmobile/MMDrawerController 首先,到下载网址下载MMDrawerController,将文件导入工程,里面有: MM ...

随机推荐

  1. Python基础操作-函数

    本节内容 1. 函数基本语法及特性2. 参数与局部变量3. 返回值4.递归5.高阶函数 1.函数基本语法及特性函数是什么? 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,具 ...

  2. [转] dpkg-deb命令

    点击此处阅读原文 function addLink() { var body_element = document.getElementsByTagName('body')[0]; var selec ...

  3. MySQL时间段查询

    现实中我们会遇到统计报表.比如查询当月每一天的数据数量...等等之类的.以下内容就是有关这方面的咯. 首先要知道几个函数 mysql> select now(); //这个是显示的当前时间 +- ...

  4. js禁止Backspace键使浏览器后退

    在项目中遇到按下Backspace键让浏览器后退的问题,上网搜了几种解决方案都不太理想.于是集众人之智,采众家之长,归纳如下: 这里主要参考博客http://q821424508.iteye.com/ ...

  5. 基于webrtc的资源释放问题(二)

    基于webrtc的资源释放问题(二) ——建立连接的过程中意外中断 应用背景: 我们在打电话的时候会不会遇到这种情况?打电话的时候未接通之前挂掉了电话,或者在接通之后建立的连接的过程中挂掉电话? 特别 ...

  6. ubuntu 设置 默认的JDK路径

    首先查询有多少种JDK已经被安装了 sudo update-alternatives --list java 其次 配置你想默认的JDK sudo update-alternatives --conf ...

  7. NOIP2014 day2 T2寻找道路

    #include<iostream> #include<cmath> #include<cstdlib> #include<cstdio> #inclu ...

  8. sendEmail报错:at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm

    sendEmail发送邮件是出现以下报错: *******************************************************************  Using the ...

  9. .net平台下获取高精度时间类

    原文:http://www.it118.org/specials/321869dd-98cb-431b-b6d2-82d973cd739d/d940a15c-0d36-4369-8de0-b07cf3 ...

  10. Android Studio 2.0使用指南

    一.下载界面.[无激活码 无序列码 无毒请放心使用][需将JAVA程序升级到1.8] 网址:http://www.android-studio.org/index.php/download/andro ...