Click here to Skip to main content
15,891,529 members
Home / Discussions / WPF
   

WPF

 
QuestionDesigner issue Pin
Tauseef A12-Nov-09 3:18
Tauseef A12-Nov-09 3:18 
AnswerRe: Designer issue Pin
Mark Salsbery12-Nov-09 7:00
Mark Salsbery12-Nov-09 7:00 
QuestionRe: Designer issue Pin
Tauseef A12-Nov-09 19:43
Tauseef A12-Nov-09 19:43 
AnswerRe: Designer issue Pin
Mark Salsbery12-Nov-09 21:36
Mark Salsbery12-Nov-09 21:36 
QuestionRe: Designer issue Pin
Tauseef A13-Nov-09 7:04
Tauseef A13-Nov-09 7:04 
AnswerRe: Designer issue Pin
Mark Salsbery13-Nov-09 7:18
Mark Salsbery13-Nov-09 7:18 
QuestionWPF Grid View Pin
sankarganesh11-Nov-09 21:48
sankarganesh11-Nov-09 21:48 
AnswerRe: WPF Grid View Pin
Pete O'Hanlon11-Nov-09 22:32
mvePete O'Hanlon11-Nov-09 22:32 
Assuming that the following is your data class:
public class MyData : INotifyPropertyChanged
{
  private event PropertyChangedEventHandler _propertyChanged;
  private int _id;
  private string _name;

  public string Name
  {
    get { return _name; }
    set
    {
      if (_name != value)
      {
        _name = value;
        OnChanged("Name");
      }
    }
  }
  public int Id
  {
    get { return _id; }
    set
    {
      if (_id != value)
      {
        _id = value;
        OnChanged("Id");
      }
    }
  }
  public event PropertyChangedEventHandler PropertyChanged
  {
    add { _propertyChanged += value; }
    remove { _propertyChanged -= value; }
  }

  private void OnChanged(string p)
  {
    PropertyChangedEventHandler handler = _propertyChanged;
    if (handler != null)
    {
      handler(this, new PropertyChangedEventArgs(p));
    }
  }
}
Add an observable collection to watch this:
private ObservableCollection<MyClass> _data = new ObservableCollection<MyClass>();
Add some data to the observable collection:
_data.Add(new MyClass{Id=1, Name="Josh"});
Assign the collection to the datacontext of your window using
DataContext = _data;
There you have the basics of the data. All you need do now, is bind the ItemsSource of the grid to the data source, as in:
ItemsSource="{Binding}"


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



QuestionSet the Text property of a TextBox Pin
soup11-Nov-09 11:53
soup11-Nov-09 11:53 
AnswerRe: Set the Text property of a TextBox Pin
Christian Graus11-Nov-09 14:08
protectorChristian Graus11-Nov-09 14:08 
GeneralRe: Set the Text property of a TextBox Pin
soup11-Nov-09 22:25
soup11-Nov-09 22:25 
AnswerRe: Set the Text property of a TextBox Pin
Jeremy Hutchinson12-Nov-09 5:03
professionalJeremy Hutchinson12-Nov-09 5:03 
GeneralRe: Set the Text property of a TextBox Pin
soup12-Nov-09 5:37
soup12-Nov-09 5:37 
QuestionHow to find Duplicate record using silverlight web service Pin
Sundeep Ganiga11-Nov-09 3:34
Sundeep Ganiga11-Nov-09 3:34 
QuestionInvoke WPF window from VBA Pin
AksharRoop11-Nov-09 2:50
AksharRoop11-Nov-09 2:50 
Questionreference issue Pin
Tauseef A10-Nov-09 19:45
Tauseef A10-Nov-09 19:45 
AnswerRe: reference issue Pin
Mark Salsbery11-Nov-09 9:58
Mark Salsbery11-Nov-09 9:58 
QuestionRe: reference issue Pin
Tauseef A11-Nov-09 10:39
Tauseef A11-Nov-09 10:39 
AnswerRe: reference issue Pin
Mark Salsbery11-Nov-09 10:48
Mark Salsbery11-Nov-09 10:48 
QuestionSession variable in Silverlight Pin
Nekkantidivya10-Nov-09 0:23
Nekkantidivya10-Nov-09 0:23 
QuestionError when calling WCF service in silverlight application. Pin
Nekkantidivya9-Nov-09 21:39
Nekkantidivya9-Nov-09 21:39 
AnswerRe: Error when calling WCF service in silverlight application. Pin
Michael Eber28-Dec-09 12:43
Michael Eber28-Dec-09 12:43 
QuestionHow to use WCF service in silver light application Pin
Nekkantidivya9-Nov-09 21:33
Nekkantidivya9-Nov-09 21:33 
AnswerRe: How to use WCF service in silver light application Pin
Mark Salsbery10-Nov-09 7:10
Mark Salsbery10-Nov-09 7:10 
AnswerRe: How to use WCF service in silver light application Pin
Michael Eber28-Dec-09 12:41
Michael Eber28-Dec-09 12:41 

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.