创建没有虚线样式的 WPF 进度条的最简单方法是什么? [英] What's the easiest way to create a WPF progress bar without the dashed style?

查看:26
本文介绍了创建没有虚线样式的 WPF 进度条的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望创建一个不使用 WPF 默认样式的进度条,它使用虚线显示.我想要的只是一个简单的平滑风格"进度条.换句话说,我不想让进度条变暗.我希望它使用纯色条.

I'm looking to create a progress bar that doesn't use the WPF default style, which uses a dashed display. All I want is a simple, "smooth style" progress bar. In other words, I don't want to progress bar to be dashed. I want it to use a solid colored bar.

最简单的方法是什么?

我认为这将是默认 API 的一部分,但到目前为止我还没有成功地使用它.除此之外,我试图设置前景画笔,它只给我颜色,而不是绘制条的样式.有没有一种方法可以不涉及我覆盖默认模板(我认为是最直接的解决方案).

I assumed this would be part of the default API but I haven't been successful playing with it so far. Among other things, I've attempted to set the foreground brush, which only give me the color, not the style of the drawn bar. Is there a way to do this that doesn't involve me overriding the default template (I suppose the most straightforward solution).

推荐答案

我能找到的最简单的方法是简单地借用和修改我想要的进度条类型的主题/样式.这与 John 的建议非常相似,但就我而言,我只是为进度条控件强制执行一种样式,而不是整个界面.CodePlex WPF 主题 项目是此类项目的绝佳资源.

The easiest way to do this that I could find was to simply borrow and modify a theme/style for the type of progress bar I wanted. This is very similar to John's suggestion but, in my case, I'm only enforcing a style for the progress bar control, not the entire interface. The CodePlex WPF themes project is an great resource for this type of thing.

这篇关于创建没有虚线样式的 WPF 进度条的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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