<

사용예제


public String UserText

        {

            get { return (String)GetValue(UserProperty); }

            set { SetValue(UserProperty, value); }

        }

 

public static readonly DependencyProperty UserProperty = DependencyProperty.Register(

            "TextChange",

            typeof(String),

            typeof(Window1),

            new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTextChangePropertyChanged)));

 

private static void OnTextChangePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

{

            Window1 userNamecontrol = d as Window1;

            string newText = (string)e.NewValue;

            string oldText = (string)e.OldValue;

 

            userNamecontrol.txtNewText.Text = newText;

            userNamecontrol.txtOldText.Text = oldText;

}

 

private void btnChange_Click(object sender, RoutedEventArgs e)

{

            UserText = textBox1.Text;

}


참고사이트 : http://dotnetmvp.tistory.com/36


블로그 이미지

희망잡이

,