我想使用它,但它不起作用,我想在代码后面创建一个平铺动画,或者如果你知道这个 gol 的项目,请写信给我
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
while(true){
Duration duration = new Duration(TimeSpan.FromSeconds(0.15));
// Create two DoubleAnimations and set their properties.
DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
myDoubleAnimation1.Duration = duration;
myDoubleAnimation1.From = -173
myDoubleAnimation1.To = 173;
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(myDoubleAnimation1);
Storyboard.SetTarget(myDoubleAnimation1, image);
// Set the attached properties of Canvas.Left and Canvas.Top
// to be the target properties of the two respective DoubleAnimations.
Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath(StackPanel.MarginProperty));
// Begin the animation.
sb.Begin();}
});
Run Code Online (Sandbox Code Playgroud) 请帮助我,为什么这个绑定不起作用,我想从PlayerBar.xaml绑定哪个datacontext是PlayerBarPresenter到PlayerBarPresenter.Card1.ImgCard就像这个Source = Binding {Source Card1,Path = ImgCard}比我得到这个例外
mscorlib.dll System.Windows.Data中出现类型'System.IO.FileNotFoundException'的第一次机会异常错误:BindingExpression路径错误:'Card1''System.String'上找不到'ImgCard'属性(HashCode = 949723141).BindingExpression:Path ='ImgCard'DataItem ='Card1'(HashCode = 949723141); target元素是'System.Windows.Controls.Image'(Name =''); target属性是'Source'(类型'System.Windows.Media.ImageSource')..
找到该文件如果只是在TablePresenter中同一个属性,但我想在TablePresenter.Card1.ImgCard中绑定
UserControl x:Class ="poki.View.PlayerBar"数据上下文是TablePresenter
<Image Width="50" Height="80" Source="{Binding Source=Card1, Path=ImgCard}" RenderTransformOrigin="0.5,0.5" Canvas.Left="108.358"
Canvas.Top="-8.349">
Run Code Online (Sandbox Code Playgroud)
TablePresenter.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using poki.View;
using System.Windows.Media.Imaging;
using poki.Model;
namespace poki.Presenters
{
public class PlayerBarPresenter : PresenterBase<PlayerBar>
{
private BitmapImage playerImage;
public BitmapImage PlayerImage
{
get { return playerImage; }
set …Run Code Online (Sandbox Code Playgroud)