You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-42Lines changed: 51 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,70 +2,81 @@ This article guides you on how to prevent user interactions on a page within a .
2
2
3
3
To prevent user interactions while the `BusyIndicator` is active, you can set the [InputTransparent](https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.visualelement.inputtransparent?view=net-maui-9.0) property of the main content's parent layout based on the [IsRunning](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Core.SfBusyIndicator.html#Syncfusion_Maui_Core_SfBusyIndicator_IsRunning) property of the BusyIndicator. The `InputTransparent` property ensures that user input is ignored when the BusyIndicator is running.
4
4
5
+
**Model**
6
+
7
+
```
8
+
public class Model
9
+
{
10
+
public string? Title { get; set; }
11
+
public string? Description { get; set; }
12
+
}
13
+
```
14
+
5
15
**ViewModel**
6
16
7
17
```
8
-
public class MainViewModel : INotifyPropertyChanged
18
+
public class MainViewModel : INotifyPropertyChanged
19
+
{
20
+
private bool _isBusy;
21
+
public bool IsBusy
9
22
{
10
-
private bool _isBusy;
11
-
public bool IsBusy
23
+
get => _isBusy;
24
+
set
12
25
{
13
-
get => _isBusy;
14
-
set
15
-
{
16
-
_isBusy = value;
17
-
OnPropertyChanged(nameof(IsBusy));
18
-
}
26
+
_isBusy = value;
27
+
OnPropertyChanged(nameof(IsBusy));
19
28
}
29
+
}
20
30
21
-
public ObservableCollection<string>? NewsHeadlines { get; set; }
22
-
public ICommand? RefreshNewsCommand { get; }
31
+
public ObservableCollection<Model>? NewsHeadlines { get; set; }
32
+
public ICommand? RefreshNewsCommand { get; }
23
33
24
-
public MainViewModel()
34
+
public MainViewModel()
35
+
{
36
+
NewsHeadlines = new ObservableCollection<Model>
25
37
{
26
-
NewsHeadlines = new ObservableCollection<string>
27
-
{
28
-
"Breaking: Market hits all-time high",
29
-
"Local Sports: Team wins championship",
30
-
"Weather Update: Storm approaching",
31
-
"Technology: New smartphone released"
32
-
};
33
-
RefreshNewsCommand = new Command(async () => await RefreshNewsAsync());
34
-
}
38
+
new Model(){ Title="Breaking: ", Description="Market hits all-time high"},
39
+
new Model(){ Title="Local Sports: ", Description="Team wins championship"},
40
+
new Model(){ Title="Weather Update: ", Description="Storm approaching"},
41
+
new Model(){ Title="Technology: ", Description="New smartphone released"},
42
+
};
43
+
RefreshNewsCommand = new Command(async () => await RefreshNewsAsync());
44
+
}
35
45
36
-
private async Task RefreshNewsAsync()
37
-
{
38
-
IsBusy = true;
39
-
await Task.Delay(2000);
40
-
NewsHeadlines?.Add("Health: New fitness trends for 2025");
41
-
NewsHeadlines?.Add("Finance: Stocks see major surge");
42
-
IsBusy = false;
43
-
}
46
+
private async Task RefreshNewsAsync()
47
+
{
48
+
IsBusy = true;
49
+
await Task.Delay(2000);
50
+
NewsHeadlines?.Add(new Model() { Title = "Health: ", Description = "New fitness trends for 2025" });
51
+
NewsHeadlines?.Add(new Model() { Title = "Finance: ", Description = "Stocks see major surge" });
52
+
IsBusy = false;
53
+
}
44
54
45
-
public event PropertyChangedEventHandler? PropertyChanged;
@@ -93,8 +104,6 @@ To prevent user interactions while the `BusyIndicator` is active, you can set th
93
104
</Grid>
94
105
```
95
106
96
-
By using the `InputTransparent` property in conjunction with the `IsRunning` property of the BusyIndicator, you can effectively block user interactions on a page within a .NET MAUI application when needed. This approach ensures that users have a clear indication of ongoing tasks and minimizes potential disruptions or errors from unintended user actions.
0 commit comments