Hi,
I am writing small windows application in WPF. I am using UserControl in WPF form. I have custom public property in UserControl called "bDirty" and same property in the WPF form (public) too.
How can I detect changes in USerControl.bDirty property in Window1.bDirty?
I am using VS 2008, C#. Please help!!
Sample code is appriciated.
Thank you
Guy
Loading
ca guyPosted Aug 14, 2009, 12:46 PM
Here is the code
UC_TestClient.xaml.cs
namespace Test
{
public partial class UC_TestClient : UserControl
{
public bool bDirty {get; set;}
Window1.xaml.cs
namespace Test
{
public partial class Window1 : Window
{
public bool bDirty_Window { get; set;}
Sorry I am not much familliar with C#
Master BillaPosted Aug 13, 2009, 10:34 PM
It's simple in WPF, here just sample code to dot, you need inherit your class from the INotifyPropertyChanged
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace StoreDatabase
{
public class Product : INotifyPropertyChanged
{
private string modelNumber;
public string ModelNumber
{
get { return modelNumber; }
set {
modelNumber = value;
OnPropertyChanged(new PropertyChangedEventArgs("ModelNumber"));
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
PropertyChanged(this, e);
}
}