I am trying to make custom conmtrol in windows phone.
My control has dependency proprty named Val of type int.
I want to add an event which for any change in inthe value of Val.
my code is :
public int Val
{
get { return (int)GetValue(ValProperty); }
set { SetValue(ValProperty,value); }
}
public static readonly DependencyProperty ValProperty = DependencyProperty.Register("Val", typeof(int), typeof(CT1), new PropertyMetadata(0, ValPropertyChanged));
private static void ValPropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
{
((CT1)target).OnValChanged((int)e.OldValue,(int)e.NewValue);
}
protected virtual void OnValChanged(int oldvalue, int newvalue)
{
//TODO
}
I dont know to proceed from here. Help needed.
Got it..
This is how it should be.