Click here to Skip to main content
15,844,903 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: [WPF] How to Stop an Animation Pin
Mark Salsbery19-May-11 11:55
Mark Salsbery19-May-11 11:55 
AnswerRe: [WPF] How to Stop an Animation Pin
Minh Hai Phan20-May-11 18:19
Minh Hai Phan20-May-11 18:19 
QuestionNot able to see any 3D objects in Silverlight 5 3D Applications Pin
Joshi, Rushikesh17-May-11 5:53
professionalJoshi, Rushikesh17-May-11 5:53 
AnswerRe: Not able to see any 3D objects in Silverlight 5 3D Applications Pin
Abhinav S17-May-11 20:05
Abhinav S17-May-11 20:05 
QuestionBinding problem Pin
DevUK16-May-11 23:45
DevUK16-May-11 23:45 
AnswerRe: Binding problem Pin
Pete O'Hanlon17-May-11 0:24
subeditorPete O'Hanlon17-May-11 0:24 
GeneralRe: Binding problem Pin
DevUK17-May-11 0:46
DevUK17-May-11 0:46 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 1:50
subeditorPete O'Hanlon17-May-11 1:50 
Try this:
C#
public class ViewModelBase : INotifyPropertyChanged
{
  public event PropertyChangedEventHandler PropertyChanged;
  protected virtual void OnChanged(string property)
  {
    PropertyChangedEventHandler handler = PropertyChanged;
    if (handler == null) return;
    handler(this, new PropertyChangedEventArgs(property));
  }
}

public class Employee : ViewModelBase
{
  string _name;
  public string Name
  {
    get
    {
      return _name;
    }
    set
    {
      if (_name == value) return;
      _name = value;
      OnChanged("Name");
    }
  }
  public Employee(string strName)
  {
    this.Name = strName;
  }
}
BTW - your problem was actually in the constructor. You had:
C#
this.Name = _name
Effectively you were assigning an empty value to Name because you were using the wrong variable; it should have been strName.

Forgive your enemies - it messes with their heads


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility


GeneralRe: Binding problem Pin
DevUK17-May-11 1:56
DevUK17-May-11 1:56 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 2:01
subeditorPete O'Hanlon17-May-11 2:01 
GeneralRe: Binding problem Pin
Tarun.K.S17-May-11 3:21
Tarun.K.S17-May-11 3:21 
AnswerRe: Binding problem Pin
Abhinav S17-May-11 1:12
Abhinav S17-May-11 1:12 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 1:53
subeditorPete O'Hanlon17-May-11 1:53 
GeneralRe: Binding problem Pin
Abhinav S17-May-11 19:23
Abhinav S17-May-11 19:23 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 21:28
subeditorPete O'Hanlon17-May-11 21:28 
AnswerRe: Binding problem Pin
yesotaso23-May-11 23:31
yesotaso23-May-11 23:31 
QuestionThread Issue: "Import" DrawingGroup Pin
Paul Selormey16-May-11 15:47
Paul Selormey16-May-11 15:47 
AnswerRe: Thread Issue: "Import" DrawingGroup Pin
Mark Salsbery16-May-11 16:44
Mark Salsbery16-May-11 16:44 
GeneralRe: Thread Issue: "Import" DrawingGroup Pin
Paul Selormey16-May-11 16:53
Paul Selormey16-May-11 16:53 
GeneralRe: Thread Issue: "Import" DrawingGroup Pin
Paul Selormey17-May-11 2:02
Paul Selormey17-May-11 2:02 
QuestionHow to modify DataTemplate programmatically? Pin
Tesic Goran16-May-11 2:24
professionalTesic Goran16-May-11 2:24 
AnswerRe: How to modify DataTemplate programmatically? Pin
Abhinav S16-May-11 3:04
Abhinav S16-May-11 3:04 
GeneralRe: How to modify DataTemplate programmatically? Pin
Tesic Goran16-May-11 3:35
professionalTesic Goran16-May-11 3:35 
AnswerRe: How to modify DataTemplate programmatically? Pin
Abhinav S16-May-11 4:10
Abhinav S16-May-11 4:10 
AnswerRe: How to modify DataTemplate programmatically? Pin
Mark Salsbery16-May-11 3:44
Mark Salsbery16-May-11 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.