绑定值为 Name2 的文本框不起作用。代码是正确的并且可以在一个简单的 WPF 应用程序中工作。有没有其他方法可以在 devexpress 中绑定?
<TextBox Height="20" TextWrapping="Wrap" Text="{Binding Path=Name2}" VerticalAlignment="Top" Margin="429,27,159,0" AcceptsReturn="True">
public partial class EntitiesView : UserControl, INotifyPropertyChanged
{
private string _name2;
public string Name2
{
get { return _name2; }
set
{
_name2 = value;
RaisePropertyChanged("Name2");
}
}
public EntitiesView()
{
Name2 = "abcdefffffffffffff";
DataContext = this;
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}