Reputation: 103
I have implemented INotifyPropertyChanged
for static property in my code. But it doesn't affect UI. Here i have added my code. Anyone has idea on this. Thanks in Advance.
private static string dateTimeValue;
public static string DateTimeValue { get { return dateTimeValue; } set
{ dateTimeValue = value; RaisedPropertyChanged("DateTimeValue"); } }
static void RaisedPropertyChanged([CallerMemberName] string name = null)
{
if (PropertyChanged != null)
PropertyChanged(null, new PropertyChangedEventArgs(name));
}
The xaml code is,
<Label Text="{Binding Source={x:Static local:LoginPageModel.DateTimeValue}, UpdateSourceEventName=PropertyChanged}">
Upvotes: 0
Views: 612
Reputation: 73
I'm assuming that your 'LoginPageModel' class is static as well because you're using the 'x:Static' markup extension, in that case, your code seems correct except the 'UpdateSourceEventName=PropertyChanged' is not be necessary and this may be causing your UI not to update.
Upvotes: 1