Loading...
Loading...
Compare original and translation side by side
Syncfusion.SfBusyIndicator.WPFSyncfusion.Windows.Controls.NotificationSyncfusion.SfBusyIndicator.WPFSyncfusion.SfBusyIndicator.WPFSyncfusion.Windows.Controls.NotificationSyncfusion.SfBusyIndicator.WPF<Window xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Controls.Notification;assembly=Syncfusion.SfBusyIndicator.WPF"
x:Class="BusyIndicatorApp.MainWindow">
<Grid Background="CornflowerBlue">
<syncfusion:SfBusyIndicator IsBusy="True"
AnimationType="Flight"
Header="Loading..."
Foreground="White"/>
</Grid>
</Window><Window xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Controls.Notification;assembly=Syncfusion.SfBusyIndicator.WPF"
x:Class="BusyIndicatorApp.MainWindow">
<Grid Background="CornflowerBlue">
<syncfusion:SfBusyIndicator IsBusy="True"
AnimationType="Flight"
Header="Loading..."
Foreground="White"/>
</Grid>
</Window><Grid>
<syncfusion:SfBusyIndicator IsBusy="{Binding IsLoading}"
AnimationType="DoubleCircle"
Header="{Binding LoadingMessage}"/>
</Grid>public class MainViewModel : INotifyPropertyChanged
{
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
private string _loadingMessage = "Please wait...";
public string LoadingMessage
{
get => _loadingMessage;
set { _loadingMessage = value; OnPropertyChanged(); }
}
public async Task LoadDataAsync()
{
IsLoading = true;
LoadingMessage = "Loading data...";
await Task.Delay(3000); // Simulate operation
IsLoading = false;
}
}<Grid>
<syncfusion:SfBusyIndicator IsBusy="{Binding IsLoading}"
AnimationType="DoubleCircle"
Header="{Binding LoadingMessage}"/>
</Grid>public class MainViewModel : INotifyPropertyChanged
{
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
private string _loadingMessage = "Please wait...";
public string LoadingMessage
{
get => _loadingMessage;
set { _loadingMessage = value; OnPropertyChanged(); }
}
public async Task LoadDataAsync()
{
IsLoading = true;
LoadingMessage = "Loading data...";
await Task.Delay(3000); // Simulate operation
IsLoading = false;
}
}public class DataViewModel : ViewModelBase
{
private bool _isBusy;
public bool IsBusy
{
get => _isBusy;
set => SetProperty(ref _isBusy, value);
}
public ICommand LoadCommand { get; }
public DataViewModel()
{
LoadCommand = new RelayCommand(async () => await LoadDataAsync());
}
private async Task LoadDataAsync()
{
IsBusy = true;
try
{
var data = await _dataService.GetDataAsync();
// Process data
}
finally
{
IsBusy = false;
}
}
}public class DataViewModel : ViewModelBase
{
private bool _isBusy;
public bool IsBusy
{
get => _isBusy;
set => SetProperty(ref _isBusy, value);
}
public ICommand LoadCommand { get; }
public DataViewModel()
{
LoadCommand = new RelayCommand(async () => await LoadDataAsync());
}
private async Task LoadDataAsync()
{
IsBusy = true;
try
{
var data = await _dataService.GetDataAsync();
// Process data
}
finally
{
IsBusy = false;
}
}
}<StackPanel>
<ComboBox x:Name="AnimationSelector" SelectedIndex="0">
<ComboBoxItem Content="Flight"/>
<ComboBoxItem Content="DoubleCircle"/>
<ComboBoxItem Content="Spin"/>
</ComboBox>
<syncfusion:SfBusyIndicator IsBusy="True"
AnimationType="{Binding ElementName=AnimationSelector,
Path=SelectedItem.Content}"/>
</StackPanel><StackPanel>
<ComboBox x:Name="AnimationSelector" SelectedIndex="0">
<ComboBoxItem Content="Flight"/>
<ComboBoxItem Content="DoubleCircle"/>
<ComboBoxItem Content="Spin"/>
</ComboBox>
<syncfusion:SfBusyIndicator IsBusy="True"
AnimationType="{Binding ElementName=AnimationSelector,
Path=SelectedItem.Content}"/>
</StackPanel><Grid>
<!-- Main content -->
<ContentControl Content="{Binding MainContent}"/>
<!-- Overlay busy indicator -->
<Grid Background="#80000000"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibilityConverter}}">
<syncfusion:SfBusyIndicator IsBusy="{Binding IsBusy}"
AnimationType="Ball"
Header="Processing..."
Foreground="White"
ViewboxHeight="150"
ViewboxWidth="150"/>
</Grid>
</Grid><Grid>
<!-- Main content -->
<ContentControl Content="{Binding MainContent}"/>
<!-- Overlay busy indicator -->
<Grid Background="#80000000"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibilityConverter}}">
<syncfusion:SfBusyIndicator IsBusy="{Binding IsBusy}"
AnimationType="Ball"
Header="Processing..."
Foreground="White"
ViewboxHeight="150"
ViewboxWidth="150"/>
</Grid>
</Grid><syncfusion:SfBusyIndicator IsBusy="{Binding IsProcessing}">
<syncfusion:SfBusyIndicator.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding CurrentOperation}"
FontSize="14" FontWeight="Bold"/>
<TextBlock Text="{Binding ProgressPercentage, StringFormat='Progress: {0}%'}"
FontSize="11" Margin="0,5,0,0"/>
</StackPanel>
</DataTemplate>
</syncfusion:SfBusyIndicator.HeaderTemplate>
</syncfusion:SfBusyIndicator><syncfusion:SfBusyIndicator IsBusy="{Binding IsProcessing}">
<syncfusion:SfBusyIndicator.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding CurrentOperation}"
FontSize="14" FontWeight="Bold"/>
<TextBlock Text="{Binding ProgressPercentage, StringFormat='Progress: {0}%'}"
FontSize="11" Margin="0,5,0,0"/>
</StackPanel>
</DataTemplate>
</syncfusion:SfBusyIndicator.HeaderTemplate>
</syncfusion:SfBusyIndicator>| Property | Type | Description |
|---|---|---|
| IsBusy | bool | Controls whether the animation is displayed |
| AnimationType | AnimationTypes | Sets the animation style (Flight, Spin, etc.) |
| AnimationSpeed | double | Controls animation speed (not for Fluent type) |
| Header | object | Text or content displayed below animation |
| HeaderTemplate | DataTemplate | Custom template for header content |
| ViewboxHeight | double | Height of the animation viewbox |
| ViewboxWidth | double | Width of the animation viewbox |
| 属性 | 类型 | 说明 |
|---|---|---|
| IsBusy | bool | 控制是否显示动画 |
| AnimationType | AnimationTypes | 设置动画样式(Flight、Spin等) |
| AnimationSpeed | double | 控制动画速度(不适用于Fluent类型) |
| Header | object | 显示在动画下方的文本或内容 |
| HeaderTemplate | DataTemplate | 标题内容的自定义模板 |
| ViewboxHeight | double | 动画视图框的高度 |
| ViewboxWidth | double | 动画视图框的宽度 |
| Method | Description |
|---|---|
| Dispose() | Releases managed and unmanaged resources |
| Dispose(Boolean) | Protected overload for resource cleanup |
| OnApplyTemplate() | Override to access template parts |
| OnAnimationTypeChanged() | Override to handle animation type changes |
| OnPropertyChanged() | Override to monitor property changes |
| 方法 | 说明 |
|---|---|
| Dispose() | 释放托管和非托管资源 |
| Dispose(Boolean) | 用于资源清理的受保护重载方法 |
| OnApplyTemplate() | 重写以访问模板部件 |
| OnAnimationTypeChanged() | 重写以处理动画类型变更 |
| OnPropertyChanged() | 重写以监控属性变更 |
getting-started.mdgetting-started.md