The properties need to be declared in C# using DependencyProperty.Register (or, if you are not creating a custom button tyoe, DependencyProperty.RegisterAttached). Here's the declaration if you are creating a custom button class:
public static readonly DependencyProperty ButtonBorderColourProperty =
DependencyProperty.Register("ButtonBorderColour",
typeof(Color), typeof(MyButton)); // optionally metadata for defaults etc.
public Color ButtonBorderColor
{
get { return (Color)GetValue(ButtonBorderColourProperty); }
set { SetValue(ButtonBorderColourProperty, value); }
}
If you are not creating a custom class, but want to define properties that can be set on a normal Button, use RegisterAttached:
public static class ButtonCustomisation
{
public static readonly DependencyProperty ButtonBorderColourProperty =
DependencyProperty.RegisterAttached("ButtonBorderColour",
typeof(Color), typeof(ButtonCustomisation)); // optionally metadata for defaults etc.
}
They can then be set in XAML:
<local:MyButton ButtonBorderColour="HotPink" />
<Button local:ButtonCustomisation.ButtonBorderColour="Lime" />