DependencyProperty SetValue和GetValue无法检测到silverlight [英] DependencyProperty SetValue and GetValue couldnt detect silverlight

查看:121
本文介绍了DependencyProperty SetValue和GetValue无法检测到silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看似GetValue和SetValue(下面的粗体)可以在读取DependencyProperty之后检测到&bbsp; b $ p

It seems like the GetValue and SetValue (bolded below) could detect after having readonly DependencyProperty 

public bool TouchMove

public bool TouchMove

        {

            get {return(bool) GetValue (TouchMoveProperty); }¥b $ b           设为

            {

SetValue (TouchMoveProperty,值);



                if(value)

                    this.MoveChanged + = new TransformHandler(TouchElement_MoveChanged);

               否则

                    this.MoveChanged - = new TransformHandler(TouchElement_MoveChanged);

            }




$
        }




        public static readonly DependencyProperty TouchMoveProperty =

            DependencyProperty.Register(" TouchMove",typeof(bool),typeof(TouchElement),new PropertyMetadata(false));



        public delegate void TransformHandler(object sender,TransformEventArgs e);



       公共事件TransformHandler MoveChanged;



        void TouchElement_MoveChanged(object sender,TransformEventArgs e)

        {

            var theMainWnd = Application.Current.RootVisual as MainPage;



           故事板myStoryboard =(故事板)(theMainWnd.FindName(" TransformImage"));

            myStoryboard.Begin();

        }

        {
            get { return (bool)GetValue(TouchMoveProperty); }
            set
            {
SetValue(TouchMoveProperty, value);

                if (value)
                    this.MoveChanged += new TransformHandler(TouchElement_MoveChanged);
                else
                    this.MoveChanged -= new TransformHandler(TouchElement_MoveChanged);
            }



        }


        public static readonly DependencyProperty TouchMoveProperty =
           DependencyProperty.Register("TouchMove", typeof(bool), typeof(TouchElement), new PropertyMetadata(false));

        public delegate void TransformHandler(object sender, TransformEventArgs e);

        public event TransformHandler MoveChanged;

        void TouchElement_MoveChanged(object sender, TransformEventArgs e)
        {
            var theMainWnd = Application.Current.RootVisual as MainPage;

            Storyboard myStoryboard = (Storyboard)(theMainWnd.FindName("TransformImage"));
            myStoryboard.Begin();
        }

推荐答案

嗨学习者,

您能再详细说明一下您的问题吗?

Can you please clarify your issue a bit more?

Jason


这篇关于DependencyProperty SetValue和GetValue无法检测到silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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