Sometimes it is necessary to bind to a custom property on a Silverlight Control. In order for that to work properly, you need to set it up as a DependencyProperty.
public int Denominator
{
get { return (int)this.GetValue(DenominatorProperty); }
set { this.SetValue(DenominatorProperty, value); }
}
public static readonly DependencyProperty DenominatorProperty
= DependencyProperty.Register(
"Denominator", //Property Name
typeof(int), //Property Type
typeof(QualitativeStatusIndicator), // type of Control
new PropertyMetadata(
0, // default value
Denominator_PropertyChangedCallback)); // callback
private static void Denominator_PropertyChangedCallback(
DependencyObject d, DependencyPropertyChangedEventArgs e)
{
QualitativeStatusIndicator myControl
= d as QualitativeStatusIndicator;
myControl.SetStatus();
}
No comments:
Post a Comment