Reputation: 760
I have some WPF control called Foo. Grid structure with DevExpress LoadingDecorator looks like that:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<dx:LoadingDecorator Name="Decorator" IsSplashScreenShown="{Binding Path=ShowLoader}" SplashScreenLocation="CenterWindow">
<dx:LoadingDecorator.SplashScreenTemplate>
<DataTemplate>
<dx:WaitIndicator DeferedVisibility="True">
<dx:WaitIndicator.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text="Operation:" FontSize="15"/>
<TextBlock Text="{Binding Path=CurrLoadStat}"/>
</StackPanel>
</DataTemplate>
</dx:WaitIndicator.ContentTemplate>
</dx:WaitIndicator>
</DataTemplate>
</dx:LoadingDecorator.SplashScreenTemplate>
</dx:LoadingDecorator>
</StackPanel>
...
</Grid>
Base ViewModel class implements INotifyPropertyChanged interface and ViewModel class (FooViewModel) used as DataContext for control with Grid described above inherits from it. I have implemented property to change text property in 2nd TextBlock element:
private string currLoadStat = "Preparing data...";
public string CurrtLoadStat
{
get
{
return currLoadStat;
}
set
{
currLoadStat = value;
OnPropertyChanged("CurrLoadStat");
}
}
My problem is that binding instruction doesn't work and I see only text defined in first TextBlock. Can You provide me some solution to resolve this problem?
Upvotes: 0
Views: 624
Reputation: 2535
Your property has a "t" in the middle of the name but your binding path (XAML) and magic string you pass to OnPropertyChanged
do not. The string you pass when you raise the PropertyChanged
event method must exactly match your view model's property name.
If you are using C# 5 or 6 then switch to using one of the approaches outlined here and you would eliminate the need for passing magic strings.
Upvotes: 2