在WPF按钮显示点

编程入门 行业动态 更新时间:2024-10-26 08:23:13
本文介绍了在WPF按钮显示点 - 点 - 点进步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发现用来表示在进度条和轮然而使用进度相当多的例子;我能找到的只有一个JavaScript的例子来说明一个省略号(点 - 点 - 点)指的进步,因此我觉得问这个问题的。我的应用程序是不是很复杂 - 它只有几个检查框和一个按钮。最近我的团队要求提供的增强,并希望保持它很简单。

I found quite a few examples for showing progress where the progress bars and wheels are used however; I could find only one javascript example to show an ellipsis (dot-dot-dot) to refer progress hence I thought of asking this question. My app is not very complex - it only has a few check-boxes and one button. Recently my team requested for an enhancement and want to keep it simple as well.

有一个名为GO用户配置所需的设置后,点击按钮。其背后的code也确实简单 - 它的单击事件后关闭按钮,呼叫是使用一个独立的EXE 的ProcessStartInfo 执行三项行动reconcle,岗位和发布。我用的是 WaitForExist()的方法来重新启用按钮。

There is a button named 'GO' that the user clicks after configuring the required settings. The code behind it is also really straightforward - it disables the button after the click event and call's a standalone exe using ProcessStartInfo that performs three actions 'reconcle', 'post' and 'publish'. I use the WaitForExist() method to re-enable the button.

我的要求我的团队,以显示在按钮上的当前进程。他们只是想在按钮上的文字显示调和。核对..核对...(定期说,1秒),随后以类似的方式发布和出版

I was requested by my team to show the 'current process' on the button. They simply want the button text to show Reconciling. Reconciling.. Reconciling... (at regular intervals say, 1 sec) followed by Posting and Publishing in a similar fashion.

这将是很好知道最合适的方式来实现这一目标。先谢谢了。

It would be nice to know the most appropriate way to achieve this. Thanks in advance.

推荐答案

这样做的最简单的方法是使用 ObjectAnimationUsingKeyFrames 。设置TargetProperty上的内容,并设置每个 DiscreteObjectKeyFrame 的值到调和。调和调和... ... 。

The simplest way of doing that is using an ObjectAnimationUsingKeyFrames. Set the TargetProperty on the Content and set the Value of each DiscreteObjectKeyFrame to Reconciling. Reconciling.. Reconciling....

例如用于控件模板与内容presenter 名为 PART_Content :

<ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Content" Duration="00:00:00.8" RepeatBehavior="Forever"> <DiscreteObjectKeyFrame KeyTime="00:00:00.0" Value="Loading"/> <DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="Loading."/> <DiscreteObjectKeyFrame KeyTime="00:00:00.4" Value="Loading.."/> <DiscreteObjectKeyFrame KeyTime="00:00:00.6" Value="Loading..."/> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> </Trigger> </ControlTemplate.Triggers>

更多推荐

在WPF按钮显示点

本文发布于:2023-07-05 14:43:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1038478.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!