Link to home
Start Free TrialLog in
Avatar of doramail05
doramail05Flag for Malaysia

asked on

DependencyProperty SetValue and GetValue couldnt detect in silverlight

It seems like the GetValue and SetValue (bolded below) couldn't detect even though after having readonly DependencyProperty

public bool TouchMove
        {
            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();
        }
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Not sure about your problem, but I can tell that get and set should contain only GetValue and SetValue. All other management shall be done through coercion methods declared on the DP metadata.
Some tutorial:
http://www.developerfusion.com/article/84469/wpf-dependency-properties/
ASKER CERTIFIED SOLUTION
Avatar of doramail05
doramail05
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doramail05

ASKER

found the answer from other forum