The goal is to display the information that the application is working. So I'm looking for an intelligent implementation sample of a loading spinner using WPF / MVVM.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
CircularProgressBarBlue.xaml
CircularProgressBarBlue.xaml.cs
To get this:
Stick this in a user control:
To get a cool disappearing effect on each ellipse add the following after each
ColorAnimationUsingKeyFrames
element. Be sure to point it to the correct ellipse..With Images
Visual summary of options for spinning icons. Recorded using Screen To Gif.
Font-Awesome-WPF
Documentation on GitHub.
Install via NuGet:
Looks like this:
XAML:
Icons pictured are
Spinner
,CircleOutlineNotch
,Refresh
andCog
. There are many others.Method from @HAdes
XAML copy/paste.
The customized spinner posted by @Menol had a small issue where the spinner would be shifted down and to the right by the size of one dot. I have updated the code so that it compensates for this offset by subtracting by half the dot.
Here is the updated code:
This is an update to the code given by @HAdes to parameterise width, height, and ellipse size.
This implementation automatically calculates required angles, widths, and heights on the fly.
The user control is bound to itself (code-behind) which takes care of all calculations.
XAML
Code Behind (C#)
Sample Use
Here's an example of an all-xaml solution. It binds to an "IsWorking" boolean in the viewmodel to show the control and start the animation.