我目前正在使用Windows 10移动应用
我遵循了本教程:Create a StopWatch Counter control in WPF(XAML)
但我正在使用Windows 10,所以我无法使用IMultiValueConverter
有任何建议可以帮助我解决这个问题..非常感谢你。
答案 0 :(得分:1)
以下是您可以开始的内容 - in this post Arek Kubiak liked source to his arc,可以像以下一样使用:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" xmlns:arc="using:ArcControl">
<Grid Width="80" Height="80">
<arc:Arc Thickness="3" Fill="Blue" PercentValue="{Binding Percent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<TextBlock Text="{Binding Percent}" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Grid>
代码背后的代码:
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void RaiseProperty(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
private int percent = 0;
public int Percent
{
get { return percent; }
set { percent = value; RaiseProperty(nameof(Percent)); }
}
private DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.25) };
public MainPage()
{
this.InitializeComponent();
this.DataContext = this;
timer.Tick += (s, e) => { Percent++; if (Percent > 99) Percent = 0; };
timer.Start();
}
}
当然,要使其更好,更符合您的需求,仍然需要做更多的工作,但是有很多关于圆形/径向控制的博客/帖子。您可以查看at this post,this blog和默认 ProgressBar 的样式。有了这些,您可以使用合适的 VisualStates 设计自己的控件,并且过渡看起来就像您想要的那样。