Question: I have a simple WPF application. In the code behind I have an InputFile property like this.

```
    public string InputFile
    {
        get
        {
            return _inputFile;
        }
        set
        {
            _inputFile = value;
            OnPropertyChanged("InputFile");
        }
    }

```

Inside the XAML I have a StackPanel like this:

```
    <StackPanel Orientation="Horizontal" DataContext="{Binding Path=InputFile}">
        <StackPanel.CommandBindings>
            <CommandBinding Command="Open" 
                CanExecute="OpenCanExecute"
                Executed="OpenExecuted" />
            <CommandBinding Command="Select" 
                CanExecute="SelectCanExecute"
                Executed="SelectExecuted" />
        </StackPanel.CommandBindings>
        <TextBox Text="{Binding Path=.}"></TextBox>
        <Button Command="Select">...</Button>
        <Button Command="Open">-></Button>
    </StackPanel>

```

I need to keep the stackpanel datacontext linked to InputFile to allow the commands functions to access it.

Problem: when InputFile changes, the TextBox is updated but if I type a new value in the Textbox the property InputFile is not updated (setter method is not called). Any idea?

Answer: 
You can try the following:

```
<TextBox Text="{Binding Path=., UpdateSourceTrigger=PropertyChanged}"></TextBox>

```
In your binding you can specify the mode to be two way. This will call your setter when the text box value changes from the UI.

```
<TextBox Text="{Binding Path=., Mode=TwoWay}"/>

```