Silverlight ProgressBar:动态设置InminatedGradientFill?
我正在 SL4 中设计一个 ProgressBar,除了不确定的动画之外,它几乎完成了。这是一种类型样式,ProgressBar 的宽度不是固定值。我试图在故事板中设置“To”值,但我没有取得太大成功......
<DoubleAnimation Duration="00:00:.5" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.Transform).(TransformGroup.Children)[0].X" Storyboard.TargetName="IndeterminateGradientFill" From="0" To="{Binding ElementName=ProgressBarRootGrid, Path=ActualWidth}"/>
有什么建议吗?
I'm styling a ProgressBar in SL4 and have it nearly done except for the indeterminate animation. This is to be a typed style, and the width of the ProgressBar won't be a fixed value. I'm trying to get set the "To" value in the storyboard, but I'm not having much success...
<DoubleAnimation Duration="00:00:.5" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.Transform).(TransformGroup.Children)[0].X" Storyboard.TargetName="IndeterminateGradientFill" From="0" To="{Binding ElementName=ProgressBarRootGrid, Path=ActualWidth}"/>
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议将 Shape 的 HorizontalAlignment 设置为 Stretch,然后为 RenderTransforms Scale X 属性设置动画。
这应该可以帮助您开始:
更新
由于翻译动画的某些设置方式,要完成类似于 VS2010 进度条的操作有点困难。 Silverlight Test 团队的 Jeff Wilcox 有一个很好的控件,可以满足您的需求。转到 http://www.jeff.wilcox.name/2010/08/performanceprogressbar/ 并在“获取代码”下下载RelativeAnimatingContentControl.cs。然后使用以下动画,这应该接近您正在寻找的内容
I would recommend setting the Shape's HorizontalAlignment to Stretch and then animate the RenderTransforms Scale X property.
This should get your started:
Update
To accomplish something similar to VS2010 progress bar is a little bit tougher due to some ways the translation animation is setup. Jeff Wilcox from the Silverlight Test team has a nice control that can be fitted to work for your needs. Go to http://www.jeff.wilcox.name/2010/08/performanceprogressbar/ and under 'Get the code' download the RelativeAnimatingContentControl.cs. Then use he following animation, this should be close to what you are looking for