I'm trying out custom control that has a label for its header and a textbox for its InputText. The control binds fine but I can't seem toe get it to update on PropertyChanged event. Here is how I did the class:
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header",typeof(string), typeof(CustomControl), new PropertyMetadata(null));
public static readonly DependencyProperty InputTextProperty = DependencyProperty.Register("InputText",typeof(string), typeof(CustomControl), new FrameWorkPropertyMetadata(null) {BindsTwoWayByDefault = true} );
public string Header
{
get { return (string)GetValue(HeaderProperty); }
set { SetValue(HeaderProperty,value; }
}
public string InputText
{
get { return (string)GetValue(InputTextProperty); }
set { SetValue(InputTextProperty,value; }
}
and here is the ControlTemplate:
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}" Margin="0,0,10,0"/>
<TextBox Text="{Binding InputText, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="150"/>
</StackPanel>
my call for the control looks like this:
<local:CustomControl Header="HeaderText" InputText={Binding InputString, UpdateSourceTrigger=PropertyChanged/>
What did I miss?