WPF component content not updating after view model change

Advertisements I have the following view model: public class ViewModel : ObservableObject { public string Watermark { get; set; } = "Loading…"; } where ObservableObject is from Microsoft.Toolkit.Mvvm.ComponentModel which implements INotifyPropertyChanged and INotifyPropertyChanging. I have the following XAML: <xctk:WatermarkTextBox> <xctk:WatermarkTextBox.WatermarkTemplate> <DataTemplate> <ContentControl Content="{Binding DataContext.Watermark, RelativeSource={RelativeSource AncestorType=Window}}"></ContentControl> </DataTemplate> </xctk:WatermarkTextBox.WatermarkTemplate> </xctk:WatermarkTextBox> And lastly the following C# code:… Read More WPF component content not updating after view model change

what is ? operator in NotifyPropertyChanged

Advertisements I have come across codes like PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); I was trying to find what is the meaning of PropertyChanged? in the line of code above. >Solution : This is the syntax for null propagation which was introduced in c# 6.0. Here the ? is the null-conditional operator. This code is equivalent to: if(!(PropertyChanged… Read More what is ? operator in NotifyPropertyChanged