FAQ Database Discussion Community


Refactoring INotifyPropertyChanged Setters

c#,wpf,inotifypropertychanged,getter-setter
I am sick to death of writing INPC setters like this: public string Label { get {return _label;} set { if (_label == value) return; _label = value; NotifyPropertyChanged(() => Label); } } I'd like to refactor the setting of the field the same way I did INPC; I'd like...

VB passing Parameter Value ByRef does not change value until Method exits?

vb.net,visual-studio-2010,parameter-passing,inotifypropertychanged
I have a Class in .Net Entity Framework which implements INotifyPropertyChanged. I have found an interesting problem in that my property changed setter fires a notification event, but the value of the change is not visible until the setter exits. I implemented the following to test if a property value...

MVVM Light Binding

binding,mvvm-light,inotifypropertychanged
Im working on a WPF project and use MVVM light. The textbox binding seem to not work. Do you have any idea why ? I use the INotifyPorpertyChanged implementation through the ViewModelBase Class implemented in the MVVM light framework. I have 2 textboxes Username and Password...and i would like that...

WPF: Best way to block OnPropertyChanged

c#,wpf,inotifypropertychanged
I have implemented WPF data binding with INotifyPropertyChanged. public class ExportNode : INotifyPropertyChanged { public uint Handle { get; set; } public String Text { get; set; } private bool _ischecked; public bool IsChecked { get { return _ischecked; } set { _ischecked = value; OnPropertyChanged("IsChecked"); } } public event...

How can I use a dotted path as a property name of a PropertyChangedEventHandler?

c#,xaml,inotifypropertychanged
How can I use a dotted path as a property name of a PropertyChangedEventHandler? public class Person { private int _age; public int Age { get { return _age;} set { _age = value; OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName = null) { var...

Creating a generic ObservableItem Class

c#,wpf,generics,mvvm,inotifypropertychanged
I would like to create a generic ObservableItem class, and I would like to get an ideas on how to implement it. I would like it to be generic so that i could use it with all types of types (if its possible). The reason I want to create it...

Cant get twoWay Binding from Xaml to ObservableCollection Working

c#,binding,windows-store-apps,winrt-xaml,inotifypropertychanged
Im attempting to bind a gridView to a ObservableCollection in a Windows Store App. My problem is I get the data but the set does not seem to work public class ValveData : INotifyPropertyChanged { private string valveName; private decimal waterMl; private decimal waterEc; private decimal waterPh; public string ValveName...

Trigger OnPropertyChanged in PostSharp's INotifyPropertyChanged aspect manually

inotifypropertychanged,postsharp
I'm using the NotifyPropertyChanged aspect from PostSharp. I have a situation where I need to trigger the PropertyChanged event manually, because my use case seems too complex for PostSharp to figure out. Here's the relevant excerpt from my view model: private RelayCommand _authenticateCommand; [IgnoreAutoChangeNotificationAttribute] public ICommand AuthenticateCommand { get {...

How I can bind property, which use another static property

c#,mvvm,binding,inotifypropertychanged
I use mvvm pattern in my progeсt (C#), and I have some problem. I have a label on my view, and label's text is binded to property from my viewModel: val label=new Label(); label.SetBinding<StatusViewModel>(Label.TextProperty, x=>x.TextProp); this is my view model, which implements INotifyPropertyChanged interface: class StatusViewModel { private string _textProp;...

WPF bindings do not pick up any changes

c#,wpf,xaml,mvvm,inotifypropertychanged
In my WPF application, I have some properties which I have bound to the XAML counterpart, but for some reason do not get set whenever their values change. I have implemented the INotifyPropertyChanged interface as well as set my DataContext for this View too, and it is still not picking...

INotifyPropertyChanged with Properties that have the same name

c#,wpf,inotifypropertychanged
I'm working on a system to represent data. In it we use a templetized interface that implements INotifyPropertyChanged. public interface IScalar<T> : ISignal, INotifyPropertyChanged { void Check(T value); /// <summary> /// Formats the specified value based on the item's formatting /// characteristics. Will throw an exception if the specified value...

INotifyPropertyChanged won't update the view

c#,wpf,inotifypropertychanged
I've done this so many times, but this has got me stumped. public class ObservableObject : System.ComponentModel.INotifyPropertyChanged { public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public void NotifyPropertyChanged(Object PropertyValue) { if (PropertyChanged != null) { PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(PropertyValue.ToString())); } } } Simple notify property changed. Very very simple custom class object class Device...

How to correctly use DataBinding, INotifyPropertyChanged, ListViewGridView

c#,wpf,xaml,listview,inotifypropertychanged
I ran in an Issue trying to Get my BoundData Updated in WPF. My Data is shown but my UI does not React to Changes in the Data. I have a XAML Class looking like this: <Window x:Class="CSharpBoiler.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:util="clr-namespace:Wpf.Util" Title="MainWindow" Loaded="Window_Loaded" Closing="Window_Closing" Height="Auto" Width="Auto" DataContext="{Binding matchDataList, RelativeSource={RelativeSource Self}}">...

C# WPF ListView not updated after adding new items to List

c#,wpf,list,observablecollection,inotifypropertychanged
I have a ListView bounded to a List of a class I created. When doing an operating, it was supposed to add/remove items from the list, but my ListView wasn't updated even though I used INotifyPropertyChanged. If I use ObservableCollection, it works but I need to have the list sorted,...