1
У меня есть текстовое поле на мой взгляд:Как правильно связать TextBox текст с ViewModel собственности
<TextBox x:Name="FilePath" Grid.Column="1" Height="30" Text="{Binding FilePath}"/>
В Модельное я изменяю путь на кнопку Обзор Command:
RelayCommand _browseButtonCommand;
public ICommand BrowseButtonCommand
{
get
{
if (_browseButtonCommand == null)
{
_browseButtonCommand = new RelayCommand(param =>
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if ((openFileDialog.ShowDialog() == true))
{
FilePath = openFileDialog.FileName;
}
});
}
return _browseButtonCommand;
}
}
string _filePath;
public string FilePath
{
get { return _filePath; }
set { _filePath = value; OnPropertyChanged("_filePath"); }
}
Но почему значение обновленного пути не отображается в моем текстовом поле? Я могу видеть, что значение меняется после выбора файла из диалога!
пятно на нем есть .. – Muds
Спасибо, Разбивал Мою голову на все остальное, когда не хватало этого крошечного :) – Simsons