Skip to content

Instantly share code, notes, and snippets.

@SalihKARAHAN
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SalihKARAHAN/8751560 to your computer and use it in GitHub Desktop.
Save SalihKARAHAN/8751560 to your computer and use it in GitHub Desktop.
Dependency Property on WPF Custom Control Library
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