Skip to content

Instantly share code, notes, and snippets.

@atzimler
Last active April 17, 2017 03:19
Show Gist options
  • Save atzimler/aa9e98c0febf5f26d8d0e45cfc6ead23 to your computer and use it in GitHub Desktop.
Save atzimler/aa9e98c0febf5f26d8d0e45cfc6ead23 to your computer and use it in GitHub Desktop.
using System.Windows;
using System.Windows.Controls;
namespace DependencyProperties
{
public class HelloMessageButton : Button
{
public static DependencyProperty MessageProperty =
DependencyProperty.Register(nameof(Message),
typeof(string),
typeof(HelloMessageButton),
new PropertyMetadata(null));
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
public HelloMessageButton()
{
Click += (o, e) => MessageBox.Show(Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment