Image.Height TemplateBinding не работает
Я создал CustomControl, реализованный из класса Button в WPF.
public class ImageButton : Button
{
...
public int ImageHeight
{
get { return (int)GetValue(ImageHeightProperty); }
set { SetValue(ImageHeightProperty, value); }
}
public static readonly DependencyProperty ImageHeightProperty =
DependencyProperty.Register("ImageHeight", typeof(int), typeof(ImageButton), new UIPropertyMetadata(32));
...
}
И у меня есть шаблон ресурса, как это:
Свойство ImageHeight зависимость не делаетт обязательный. Когда я пишу, как показано ниже, он работает успешно.
Height="32"
Что не так с этим?