如何创建圆形样式ProgressBar [英] How to create a Circular Style ProgressBar

查看:139
本文介绍了如何创建圆形样式ProgressBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实现这种圆形进度条时,我需要帮助:

I need help on implementing a circular progress bar like this:

我应该如何通过增加 Value 属性来实现Circle来填充?

How should I implement the Circle to fill by increasing Value property?

推荐答案

您有几个选择-第一个是模板 ProgressBar 控制。事实证明这有点棘手。我写了一篇博客文章,描述了如何使用附加的ViewModel达到所需的效果

You have a couple of options - the first is to template the ProgressBar control. This turns out to be a little tricky. I wrote a blog post which describes how to use an attached ViewModel to achieve the required effect.

另一种方法是从头开始创建自己的控件。您可以执行以下操作:

The other alternative is to create your own control from scratch. You could do the following:


  1. 创建新的用户控件

  2. 添加新的值,最大值和最小依赖属性。

  3. 处理用户控件中的Value,Maximum和Minimum属性更改事件以计算Angle属性。

  4. 构造两个后面代码中的小块(请参见此帖子)并添加他们到用户界面。

  1. Create a new user control
  2. Add new Value, Maximum and Minimum dependency properties to it.
  3. Handle the Value, Maximum and Minimum property change events in your user control to compute an Angle property.
  4. Construct two 'pie pieces' in code behind (see this post) and add them to the UI.

这篇关于如何创建圆形样式ProgressBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆