-
WPF ViewModel with INotifyPropertyChanged doesnot work
Hi,
I created a viewmodel implementing interface 'INotifyPropertyChanged'.
I then accessed proxy object using ProxyFactory.
I used this proxy object for binding with view.
If I tried to update viewmodel object from code behind, it doesnot update View. Can anyone help me in solving this?
public class EmployeeViewModel:INotifyPropertyChanged
{
private string firstName;
public virtual event PropertyChangedEventHandler PropertyChanged;
public virtual string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
OnPropertyChanged("FirstName");
}
}
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Code for Proxy creation
private static EmployeeViewModel GetProxy()
{
try
{
EmployeeViewModel target = new EmployeeViewModel();
target.FirstName = "Aleksandar";
ProxyFactory pf = new ProxyFactory(target);
pf.AddAdvisor(new ModificationAdvisor(target.GetType()));
pf.AddIntroduction(new IsModifiedAdvisor());
pf.ProxyTargetType = true;
EmployeeViewModel proxy = (EmployeeViewModel)pf.GetProxy();
return proxy;
}
catch (Exception ex)
{
}
return null;
}
I have used Spring.AopQuickStart\Src\Spring.AopQuickStart.Step 6 project for this.
In above code I am trying to create proxy of an object implementing interface. Is it possible to do so in spring dotnet?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules