Last active
August 29, 2015 13:55
-
-
Save SalihKARAHAN/8751560 to your computer and use it in GitHub Desktop.
Dependency Property on WPF Custom Control Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static readonly DependencyProperty CaptionTextProperty = DependencyProperty.Register( | |
"CaptionText", | |
typeof(string), | |
typeof(WindowCaption), | |
new UIPropertyMetadata(CaptionTextChanged)); | |
public static void CaptionTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | |
{ | |
((WindowCaption)(sender)).Caption = e.NewValue.ToString(); | |
} | |
private string Caption | |
{ | |
get | |
{ | |
return tbWindowCaption.Text; | |
} | |
set | |
{ | |
tbWindowCaption.Text = value; | |
} | |
} | |
public string CaptionText | |
{ | |
get | |
{ | |
return (string)this.GetValue(CaptionTextProperty); | |
} | |
set | |
{ | |
this.SetValue(CaptionTextProperty, value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment