Version

Configuring Animations Brushes (xamBusyIndicator)

Topic Overview

Purpose

This topic explains how to customize the xamBusyIndicator™ control default animations brushes.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic explains the features supported by the control from developer perspective.

This topic provides an overview of the visual elements of the control.

This topic summarizes the available pre-built animations in the xamBusyIndicator control.

This topic demonstrates how to add a xamColorPicker control to your page using XAML and procedural code.

In this topic

This topic contains the following sections:

Animations Brushes Configuration Summary

Animations brushes configuration summary chart

The following table summarizes the pre-build animations in the xamBusyIndicator control, their customizable brushes and available modes – determinate and indeterminate. Additional details are available after the summary table.

Configuring Azure Animation Brushes

Overview

Use the AzureBusyAnimation LowerElementsFill and UpperElementsFill properties to change the default Azure animation brushes.

Note
Note

These properties are used for initialization and are not bindable dependency properties.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator Azure animation looks as a result of the following settings:

Property Value

#FFB8D432

#FF59B4D9

Configuring Animations Brushes 14.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="Azure" >
    <ig:XamBusyIndicator.Animation>
        <ig:AzureBusyAnimation LowerElementsFill="#FFB8D432" UpperElementsFill="#FF59B4D9"/>
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring Gears Animation Brushes

Overview

Use the GearsBusyAnimation BigGearFill and SmallGearFill properties to change the default Gears animation brushes.

Note
Note

These properties are used for initialization and are not bindable dependency properties.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator Gears animation looks as a result of the following settings:

Property Value

#FF324047

#FF43A898

Configuring Animations Brushes 7.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="Gears" >
    <ig:XamBusyIndicator.Animation>
        <ig:GearsBusyAnimation BigGearFill="#FF324047" SmallGearFill="#FF43A898"/>
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring ProgressRing Animation Brushes

Overview

Use the ProgressRingBusyAnimation RingBackground, Background, Foreground and RingFill properties to change the default ProgressRing animation brushes.

Note
Note

These properties are used for initialization and are not bindable dependency properties.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator ProgressRing animation looks as a result of the following settings:

Property Value

Red

Green

White

Blue

Configuring Animations Brushes 8.png
  1. RingFill

  2. Background

  3. RingBackground

  4. Foreground

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" IsIndeterminate="False" Name="ProgressRingDeterminate" ProgressValue=".5" >
    <ig:XamBusyIndicator.Animation>
        <ig:ProgressRingBusyAnimation RingBackground="Red" Background="Green" Foreground="White" RingFill="Blue"  />
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring SpinnerBalls Animation Brush

Overview

Use the SingleBrushBusyAnimation AnimationFill property to change the default SpinnerBalls animation brush.

Note
Note

This property is used for initialization and is not a bindable dependency property.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator SpinnerBalls animation looks as a result of the following settings:

Property Value

#FF609BAE

Configuring Animations Brushes 9.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="SpinnerBalls">
    <ig:XamBusyIndicator.Animation>
        <ig:SpinnerBallsBusyAnimation AnimationFill="#FF609BAE" />
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring SpinnerBars Animation Brush

Overview

Use the SingleBrushBusyAnimation AnimationFill property to change the default SpinnerBars animation brush.

Note
Note

This property is used for initialization and is not a bindable dependency property.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator SpinnerBars animation looks as a result of the following settings:

Property Value

#FF3C7B82

Configuring Animations Brushes 10.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="SpinnerBars" >
    <ig:XamBusyIndicator.Animation>
        <ig:SpinnerBarsBusyAnimation AnimationFill="#FF3C7B82" />
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring SpinnerBarsWave Animation Brush

Overview

Use the SingleBrushBusyAnimation AnimationFill property to change the default SpinnerBarsWave animation brush.

Note
Note

This property is used for initialization and is not a bindable dependency property.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator SpinnerBarsWave animation looks as a result of the following settings:

Property Value

#FF3C7B82

Configuring Animations Brushes 11.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="SpinnerBarsWave" >
    <ig:XamBusyIndicator.Animation>
        <ig:SpinnerBarsWaveBusyAnimation AnimationFill="#FF3C7B82" />
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Configuring SpinnerSegmented Animation Brush

Overview

Use the SingleBrushBusyAnimation AnimationFill property to change the default SpinnerSegmented animation brush.

Note
Note

This property is used for initialization and is not a bindable dependency property.

In order to change the animation brushes in runtime, see the Changing Animations Brushes in Runtime section.

Example

The screenshot below demonstrates how the xamBusyIndicator SpinnerSegmented animation looks as a result of the following settings:

Property Value

#FF43A898

Configuring Animations Brushes 12.png

Following is the code that implements this example.

In XAML:

<ig:XamBusyIndicator IsBusy="True" Name="SpinnerSegmented" >
    <ig:XamBusyIndicator.Animation>
        <ig:SpinnerSegmentedBusyAnimation AnimationFill="#FF43A898" />
    </ig:XamBusyIndicator.Animation>
</ig:XamBusyIndicator>

Changing Animations Brushes in Runtime

Introduction

The following example explains how to bind the xamBusyIndicator Gears animation brushes and change them in runtime using the xamColorPicker control.

Use the GearsBusyAnimationPresenter BigGearFill and SmallGearFill properties to bind to the xamColorPicker SelectedColorPreview property in order to change the animations colors dynamically.

Unlike the GearsBusyAnimation BigGearFill and SmallGearFill properties which are not bindable and used only for initialization, the GearsBusyAnimationPresenter BigGearFill and SmallGearFill properties are bindable dependency properties.

Preview

The following screenshot is a preview of the final result.

Configuring Animations Brushes 13.png

Prerequisites

To complete the procedure, you need the following:

  • Add the following NuGet package references to your project:

    • Infragistics.WPF.ColorPicker

    • Infragistics.WPF

    For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

Steps

The following steps demonstrate how to change the Gears animations brushes in runtime.

  1. Add the xamBusyIndicator control to your page

    In XAML:

    <ig:XamBusyIndicator Name="Gears" IsBusy="True" Animation="Gears" Width="200" />
  2. Add a xamColorPicker control to your page and bind its SelectedColorPreview property to a xamBusyIndicator animation brush

    In XAML:

    <ig:XamColorPicker SelectedColor="#FF324047" Width="100" SelectedColorPreview="{Binding ElementName=Gears, Path=AnimationPresenter.BigGearFill, Mode=TwoWay, Converter={StaticResource ColorToSolidColorBrushValueConverter}}" />

Full code

Following is the full code for this procedure.

In XAML:

<Grid>
    <Grid.Resources>
        <local:ColorToSolidColorBrushValueConverter x:Key="ColorToSolidColorBrushValueConverter" />
    </Grid.Resources>
    <StackPanel>
        <ig:XamBusyIndicator Name="Gears" IsBusy="True" Animation="Gears" Width="200" />
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Text="BigGearFill" Width="100" />
            <ig:XamColorPicker SelectedColor="#FF324047" Width="100"
            SelectedColorPreview="{Binding ElementName=Gears, Path=AnimationPresenter.BigGearFill, Mode=TwoWay, Converter={StaticResource ColorToSolidColorBrushValueConverter}}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Text="SmallGearFill" Width="100"/>
            <ig:XamColorPicker SelectedColor="#FF43A898" Width="100"
            SelectedColorPreview="{Binding ElementName=Gears, Path=AnimationPresenter.SmallGearFill, Mode=TwoWay, Converter={StaticResource ColorToSolidColorBrushValueConverter}}" />
        </StackPanel>
    </StackPanel>
</Grid>

In C#:

public class ColorToSolidColorBrushValueConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        var result = new Color();
        if (value is SolidColorBrush)
            result = ((SolidColorBrush)value).Color;
            return result;
    }
     public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
     {
         SolidColorBrush result = null;
         if (value is Color)
             result = new SolidColorBrush((Color)value);
         return result;
    }
}

In Visual Basic:

Public Class ColorToSolidColorBrushValueConverter
      Implements IValueConverter
      Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object
            Dim result = New Color()
            If TypeOf value Is SolidColorBrush Then
                  result = DirectCast(value, SolidColorBrush).Color
            End If
            Return result
      End Function
      Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object
            Dim result As SolidColorBrush = Nothing
            If TypeOf value Is Color Then
                  result = New SolidColorBrush(DirectCast(value, Color))
            End If
            Return result
      End Function
End Class

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to display the xamBusyIndicator control.

This topic explains how to configure the xamBusyIndicator busy content.

This topic explains how to configure the delay before displaying the xamBusyIndicator control.

This topic explains how to configure explicitly which UIElement receives the focus when the xamBusyIndicator is no longer active.

This topic explains how to configure the xamBusyIndicator control to display determine progress.

This topic explains how to customize the xamBusyIndicator overlay style.