混合教程问题 - 由于'GetValue','SetValue'问题,项目无法构建 [英] Blend Tutorial Problem - Project Won't Build due to 'GetValue', 'SetValue' issues

查看:63
本文介绍了混合教程问题 - 由于'GetValue','SetValue'问题,项目无法构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已尝试搜索解决方案但无济于事!

我在Design和Blend中完成了Fabrikam教程,并且在完成练习8后才遇到此问题。

基本上,当我尝试构建解决方案(/ Project)时,我收到一些错误消息,如下所示:

"VideoPlayer.Window1不包含GetValue的定义,不扩展方法等等"

问题似乎来自添加VideosPlayerControls.cs文件。我无法理解为什么它之前没有问题但是现在返回错误,但是我对游戏很陌生,所以也许我只是昏暗了:)

无论如何,这里有一个片段xaml(来自VideoPlayerControls.cs),您将提供的任何帮助将不胜感激!

公共双倍TotalDuration
{
得到
{
返回( double)this.GetValue(TotalDurationProperty);
} set
{
this.SetValue(TotalDurationProperty,value);
}
}

//定义一个自定义依赖项属性,它将存储媒体元素的当前位置(当前正在播放的视频部分)
公共双CurrentPosition
{
g et
{
return(double)this.GetValue(CurrentPositionProperty);
}
set
{
this.SetValue(CurrentPositionProperty,value);
}


私有void StartDrag(对象发送者,System.Windows.Input.MouseButtonEventArgs e)
{
this.DragMove();

Hi there, I have tried searching for the solution but to no avail!

I worked through the Fabrikam tutorials in both Design and Blend and only encountered this problem after completing Exercise 8.

Basically, when I try to Build Solution(/Project) I receive a number of error messages like the following:

"VideoPlayer.Window1 does not contain a definition for GetValue and no extension method etc etc"

The problem seems to have come from adding the VideosPlayerControls.cs file. I can't understand why it built without problems before but is now returning errors, however I am verrry new to the game so maybe I'm just being dim :)

Anyway, here's a snippet of the xaml (from VideoPlayerControls.cs), any help you can offer would be greatly appreciated!

public double TotalDuration
        {
            get
            {
                return (double)this.GetValue(TotalDurationProperty);
            }
            set
            {
                this.SetValue(TotalDurationProperty, value);
            }
        }

        // Defines a custom dependency property which will store the current position of the media element (the part of the video currently being played)
        public double CurrentPosition
        {
            get
            {
                return (double)this.GetValue(CurrentPositionProperty);
            }
            set
            {
                this.SetValue(CurrentPositionProperty, value);
            }
        }

        private void StartDrag(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            this.DragMove();

推荐答案

嗯,包含属性的类(TotalDuration和CurrentPosition)不包含GetValue方法。当您使用"this"限定成员变量或方法时,这意味着"this" object包含您正在寻找的方法(或属性)。如果您使用VisualStudio而不是Blend来实际为您的项目编写代码,intellisense(在Blend中完全缺失)将指导您。·


Well, the class that contains your properties (TotalDuration and CurrentPosition) does not contain a GetValue method.  When you qualify a member variable or method with "this", that means "this" object contains the method (or property) you're looking for. If you use VisualStudio instead of Blend to actually write code for your project, intellisense (which is completely missing in Blend) will guide you.




这篇关于混合教程问题 - 由于'GetValue','SetValue'问题,项目无法构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆