PropertyChangedEventHandler Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the method that will handle the PropertyChanged event. When programming with Microsoft .NET this delegate is hidden, use the System.ComponentModel.PropertyChangedEventHandler delegate.
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.Guid(3822998262, 7730, 23974, 187, 45, 181, 182, 9, 108, 150, 45)]
public delegate void PropertyChangedEventHandler(object sender, PropertyChangedEventArgs e);
Public Delegate Sub PropertyChangedEventHandler(sender As Object, e As PropertyChangedEventArgs)
Parameters
- sender
- Object
The source of the event.
Event data.
- Attributes
Examples
This example demonstrates how to implement the INotifyPropertyChanged interface and use PropertyChangedEventHandler. For the complete code listing, see the XAML data binding sample.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBinding
{
public class Employee : INotifyPropertyChanged
{
private string _name;
private string _organization;
public string Name
{
get { return _name; }
set
{
_name = value;
RaisePropertyChanged("Name");
}
}
public string Organization
{
get { return _organization; }
set
{
_organization = value;
RaisePropertyChanged("Organization");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
}
Remarks
When programming with Microsoft .NET, this delegate is hidden. Microsoft .NET Developers should use the System.ComponentModel.PropertyChangedEventHandler delegate.