Hey, having a bit of trouble with data binding. Followed a few tuts, and read information, but still really foggy. I'll add the code here...
Class
Code:Imports System.ComponentModel Public Class StatusBarClass Implements INotifyPropertyChanged Public statusText As String Sub setStatus() End Sub Sub setStatus(ByVal status As String) Me.statusText = status End Sub ' Declare the event Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Property status() As String Get Return statusText End Get Set(value As String) statusText = value ' Call OnPropertyChanged whenever the property is updated onPropertyChanged("status") End Set End Property Public Sub onPropertyChanged(ByVal status As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(statusText)) End Sub End Class
Main window Vb Instance of object being used
main window xamlCode:Case 1 Dim spellName As String spellName = "fireball" WordProcessor.AppendText(spellName) Dim StatBar = New StatusBarClass StatBar.setStatus("Status: Generating Fire Elemental Spell")
Would love any help, and thanks for the great site.Code:<StatusBar DockPanel.Dock="Bottom"> <TextBlock x:Name="StatusBar" Text="{Binding Path=StatusBarClass.statusText, Mode=OneWay}"></TextBlock> </StatusBar>
Merry Christmas![]()


Reply With Quote
