tags:

views:

141

answers:

1

I've got a window with my custom textbox-like control on it

<Window.Title>
    <Binding ElementName="codeBox" Path="Filename" UpdateSourceTrigger="PropertyChanged" />
</Window.Title>
...
<custom:CodeArea Name="codeBox">
</custom:CodeArea>

here what I have inside my CodeArea back code (CodeArea.xaml.cs)

private string _filename = "NoName";
public string Filename
{
    get { return _filename; }
    set { _filename = value; }
}

When application starts, it has 'NoName' title. If I open any file, Filename setter is called, but title doesn't change. What I'm doing wrong?

+2  A: 

You need to notify WPF the property has changed, you can either implement INotifyPropertyChanged in your class or make FileName a DependencyProperty

Nir
second way worked for me. Thanks!
jonny