wpf - Windows 8 WPF 进度条没有发光动画

标签 wpf windows-8 wpf-controls

Windows 窗体应用程序中的进度条具有标准的“闪耀”动画,但是当我尝试在 WPF 中添加进度条时,默认情况下我不会得到这样的动画。我们如何在 Windows 8 中使用 WPF 恢复此功能?

Windows 窗体

WPF

最佳答案

这是一个相当奇怪的修复,但您需要在应用程序中启用 Windows 窗体样式才能使用“光泽”。我就是这样做的。

  1. 在项目中添加对 System.Windows.Forms 的引用
  2. 转至项目设置页面并点击查看应用程序事件
  3. 使用以下代码(在 VB.NET、C# 中类似)将处理程序添加到您的 Application.Startup(另外,如果您需要包含参数,请这样做)
Class Application

    ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
    ' can be handled in this file.

    Private Sub Application_Startup() Handles Me.Startup
        System.Windows.Forms.Application.EnableVisualStyles()
    End Sub

End Class

似乎很奇怪,您必须调用此函数才能使 WPF 进度条正常工作,但该代码对我有用。

关于wpf - Windows 8 WPF 进度条没有发光动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17672058/

相关文章:

wpf - 在 WrapPanel 中共享可用空间

c# - WPF 用户控件 : Invoke usercontrol's public method from viewModel

button - 单击按钮时添加下拉菜单 - Windows 8

wpf - 在运行时和设计时将 ViewModel 分配给 UserControl

c# - 使用RenderTargetBitmap保存部分显示图像

c# - MVVM:将单选按钮绑定(bind)到 View 模型?

c# - 在 C# 中将参数值从一个函数传递到另一个函数

c# - Windows RT 和 C#

wpf - 如何在不切断选项卡的情况下向 WPF TabItems 添加水平边距?

wpf-controls - “工具提示”不能有逻辑或视觉父级