propertychanged

wpf update ListViewItem background property

I have a listview that is binded to a ThreadSafeObservableCollection. The background of each of these items is set to an enum that is run through a color converter, here's the code for these 2 settings. <UserControl.Resources> <EncoderView:EncoderStatusToColorConverter x:Key="ColorConverter"/> <Style x:Key="ItemContStyle" Targe...

Monitor changes to settings in app.config

When I use typesafe application settings, I have something like this in my app.exe.config file: <setting name="IntervalTimeout" serializeAs="String"> <value>10</value> </setting> The Settings.Designer.vb does something like this: <Global.System.Configuration.ApplicationScopedSettingAttribute(), _ Global.System.Diagnostics.Debug...

Some Problem with WPF Databinding but You Have to Guess What Kind

I'm trying to implement a property changed event (or which ever is appropriate) in my wpf project and I'm trying to find the best way to do this. I have this header where it has an expand/collapse icon and in my window, I might have multiple headers. I want the default to be collapsed when all headers are listed in the beginning but whe...

WPF CustomControl: OnApplyTemplate called after PropertyChangedCallback

I am creating a WPF CustomControl that has a dependency property with PropertyChangedCallback. In that Callback method I try to set values on some of the control's parts that I retrieve from OnApplyMethod using the GetTemplateChild() method. The problem is that the PropertyChangedCallback is (on some systems) called before OnApplyTempla...

Locking strategy with PropertyChangeListener

I've defined a class with a number of "observable" properties. Internally the class contains a single thread that performs I/O; e.g. public class Foo { private final PropertyChangeSupport support; private State state; public Foo() { this.support = new PropertyChangeSupport(this); } public synchronized State getState() { retur...

PropertyChanged Event, raise when OnClick???

Hi, I have a WinForms application with some business objects which implement INotifyPropertyChanged and hook the PropertyChanged event via some controls & BindingSource on the form which raises an event back to my business objects layer... There's just one issue - everything works fine, except only when the control loses focus. E.G., t...

C# - How do I change the value of a property based on changes to another property (ObservableCollection)?

How do I change the value of TotalPublicationsRead, when the Read property of a Publication has changed? public class Report { public ObservableCollection<Publication> Publications { get; set; } public int TotalPublicationsRead { get; set; } } public class Publication : INotifyPropertyChanged { private bool read; public boo...

Why does .NET read values of unaffected properties on reception of INotifyPropertyChanged.PropertyChanged event?

Hi everyone! I'm new to data binding and encountered the following oddity today which I fail to understand: I have a form with two labels (labelA and labelB) and two buttons (buttonA and buttonB). The form hosts an object (called "formState") with two properties (CountA and CountB). labelA.Text is data-bound to formState.CountA, labelB...

C# - How to determine whether a property is changed

Hi Guys, I need to know whether a public property (which has getter & setter) is changed. The property is in a simple class (no user control/component etc). Is there an elegant way to subscribe to some kind of event which notifies when property is changed? I tried to see what microsoft is doing in their Binding object (using reflector) a...

Making mocks trigger PropertyChanged when changed

I am using RhinoMocks, and I have a Mock which has a property I need to behave as a real property - updating its value when set, and also trigger PropertyChanged when the property is changed. The interface of the mocked object is in essence this: public interface IFoo { event PropertyChangedEventHandler PropertyChanged; int B...

Correct way to trigger object clone/memento when property changes

Hi, I have a big doubt about the correct way to save an object state (clone object), if necessary to rollback the changes, when a property has changed. I know that the IEditableObject interface exists for those cases but during some tests the BeginEdit would just fire like crazy (I have a DataGrid whose values can be edited but I won't ...

WPF Update Binding when Bound directly to DataContext w/ Converter

Normally when you want a databound control to 'update,' you use the "PropertyChanged" event to signal to the interface that the data has changed behind the scenes. For instance, you could have a textblock that is bound to the datacontext with a property "DisplayText" <TextBlock Text="{Binding Path=DisplayText}"/> From here, if the Dat...

How to best implement IPropertyChanged on Timespan subtype?

in .NET (and WPF), I need to monitor changes on a Timespan object which doesn't include any change event like PropertyChanged. What would be the best way to add this functionnality? ...

What is the difference between PropertyChangeListener and VetoableChangeListener?

Hi, Everything is in the title of the question. Can you provide some use case we use PropertyChangeListener and VetoableChangeListener ? ...

WPF DataBinding: Bind to a property that references two other properties

Basically, how do I bind (one-way) to a textbox named txtFullName. Initially, any text in the text box gets cleared/blanked out since ToString returns "". But, when I make changes to FirstName or LastName it does not update the binding against FullName. Any way to do this? Also, is there any way to bind to a method (not just a field)? T...

WPF excessive PropertyChanged events

Typically in the property setter of an object we may want to raise a PropertyChanged event such as, public event PropertyChangedEventHandler PropertyChanged; protected void Notify(string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); ...

WPF - ObservableCollection PropertyChanged event?

I have an object which has a property of type ObservableCollection<bool>. It is bound to a list of checkboxes on a form using TwoWay bindings. I would like to add a PropertyChanged notification to this so that if certain values are selected, some other ones get automatically deselected. Is there a way to do this? The ObservableCollect...

How to use INotifyPropertyChanged correctly in WPF/XAML

I have a custom object that I am trying to bind to a control. On that custom object I have implemented the INotifyPropertyChanged interface. I have successfully bound to my object and a property on that object. What I can't figure out is how to go from there. I've been working on this for 2 days now and I still cannot get it working. M...

PropertyChangedEventHandler PropertyChanged is null

i am implementing PropertyChangedEventHandler PropertyChanged and it's always null. property string is right donno where is the problem here is the code i am using public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHan...

PropertyChangedEventHandler is null in FirePropertyChanged

Hi, I have a viewmodel named EmployeeViewModel which is inherited from ViewModelBase. here is the implementation of ViewModelBase. public event PropertyChangedEventHandler PropertyChanged; public void FirePropertyChanged(string propertyname) { var handler = PropertyChanged; if (handler != null) ha...