Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BitmapEffect Class

Defines a bitmap effect. Derived classes define effects that can be applied to a Visual object, such as a Button or an Image.

Namespace: System.Windows.Media.Effects
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public abstract class BitmapEffect : Animatable
public abstract class BitmapEffect extends Animatable
public abstract class BitmapEffect extends Animatable
This class is abstract; see Inheritance Hierarchy for derived non-abstract classes usable in XAML.


WPF bitmap effects are software rendered. Any object that applies an effect will also be rendered in software. Bitmap effects should not be applied to large visuals or animations, because this can degrade performance.

Caution noteCaution:

Bitmap effects do not support partial trust execution. An application must have full trust permissions to use bitmap effects.

Scale transforms are applied to a visual before an effect is applied. In the event of a non-uniform scale transform, the effect will use the larger of the scale values.

Updates to the visual tree of a VisualBrush will not propagate if a BitmapEffect is in the brush's parent chain. You can work around this limitation by forcing an update of the scene on the parent object of the effect. You can call InvalidateVisual or include an animation to force a scene update.

Custom effects inherit this class to create a managed interface to the unmanaged effect. For more details on creating custom effect see the Custom BitmapEffect Sample - RGBFilter and the Unmanaged BitmapEffect API.

Notes to Inheritors: CreateUnmanagedEffect must be overridden to initialize an unmanaged effect in managed code. UpdateUnmanagedPropertyState must be overridden when an unmanaged effect has properties that the user can modify. Use this method in conjunction with SetValue to update your unmanaged properties.

This example shows how to use a custom effect in Extensible Application Markup Language (XAML).

Custom effects are created with unmanaged API and create a Component Object Model (COM) dynamic-link library (DLL). To use custom effect in managed code, a managed assembly is used to define the BitmapEffect and to interact with the Component Object Model (COM) library. To use this custom effect in an application, the assembly must be referenced and the effect must use the namespace referenced by the assembly. For the complete sample, see Custom BitmapEffect Sample - RGBFilter.

The following example shows how to define a namespace and reference the assembly that implements the custom effect.

<Window x:Class="RGBFilterEffectTest.Window1"
    Title="RGBFilterEffectTest" Height="400" Width="300"

The following example uses the custom effect by referencing the namespace provided in the above example.

<Image Name="RTB" Source="images/kittens.jpg">
    <RGBFilter:RGBFilterBitmapEffect >
        <Binding ElementName="redSlider" Path="Value"/>
        <Binding ElementName="greenSlider" Path="Value"/>
        <Binding ElementName="blueSlider" Path="Value"/>
    </RGBFilter:RGBFilterBitmapEffect >

             Derived Classes

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2017 Microsoft