How to use <ObservableProperty>
in vb.net?
#761
-
I wasn't able to find an Basically, I try to rebuild this Imports CommunityToolkit.Mvvm.ComponentModel
Imports System.Windows.Threading
Partial Public Class ViewModelBase
Inherits ObservableObject
Implements IViewModelBase
<ObservableProperty>
Private Provider As IServiceProvider
<ObservableProperty>
Private IsLoading As Boolean = False
<ObservableProperty>
Private IsLoadingData As Boolean = False
<ObservableProperty>
Private IsLoadingDataCounter As Integer = 0
Partial Private Sub OnIsLoadingDataCounterChanged(ByVal value As Integer)
If value < 0 Then isLoadingDataCounter = 0
isLoadingData = value > 0
End Sub
<ObservableProperty>
Private IsBusy As Boolean = False
<ObservableProperty>
Private IsBusyCounter As Integer = 0
Partial Private Sub OnIsBusyCounterChanged(ByVal value As Integer)
If value < 0 Then isBusyCounter = 0
isBusy = value > 0
End Sub
<ObservableProperty>
Private IsReady As Boolean = False
<ObservableProperty>
Private IsStartUp As Boolean = True
<ObservableProperty>
Private IsStartingUp As Boolean = False
<ObservableProperty>
Private IsRefreshing As Boolean = False
<ObservableProperty>
Private IsResuming As Boolean = False
<ObservableProperty>
Private IsBeta As Boolean = False
<ObservableProperty>
Private IsPortrait As Boolean = True
Public Sub New()
End Sub
Public Sub New(ByVal provider As IServiceProvider)
provider = provider
End Sub
End Class
Imports System.ComponentModel
Interface IViewModelBase
Inherits INotifyPropertyChanged
Property IsBusyCounter As Integer
Property IsBusy As Boolean
Property IsLoading As Boolean
Property IsReady As Boolean
Property IsStartUp As Boolean
Property IsRefreshing As Boolean
Property IsStartingUp As Boolean
Property IsBeta As Boolean
Property IsResuming As Boolean
Property IsPortrait As Boolean
End Interface
|
Beta Was this translation helpful? Give feedback.
Answered by
Sergio0694
Sep 21, 2023
Replies: 1 comment 1 reply
-
This is expected, the source generators are only supported when writing C#. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Sergio0694
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is expected, the source generators are only supported when writing C#.
If you're using VB.NET, you'll have to write observable properties manually 🥲