I have created a new VB project (named TestPrismVB), installed Prism and I have written this simple code:
Is it a VB bug? A Prism bug? Am I doing something wrong?
Thank you
Imports Microsoft.Practices.Prism.Mvvm
Public Class pruebaViewModel
Inherits BindableBase
Private Property _oneProperty As String
Public Property oneProperty As String
Get
Return _oneProperty
End Get
Set(value As String)
SetProperty(_oneProperty, value)
'IF I UNCOMMENT THIS LINE, IT WORKS:
'OnPropertyChanged("oneProperty")
End Set
End Property
Private Property _anotherProperty As String
Public Property anotherProperty As String
Get
Return _anotherProperty
End Get
Set(value As String)
SetProperty(_anotherProperty, value)
oneProperty = value
End Set
End Property
End Class
And the XAML file is MainWindow.xaml:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:TestPrismVB"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<vm:pruebaViewModel/>
</Window.DataContext>
<StackPanel>
<TextBox Text="{Binding anotherProperty, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text ="{Binding oneProperty}"/>
</StackPanel>
</Window>
If you run this simple project, and you type 1234, you will see that the TextBlock updates one step behind (it will show 123 instead of 1234).Is it a VB bug? A Prism bug? Am I doing something wrong?
Thank you