Export (0) Print
Expand All

WriteableBitmap.TryLock Method

Attempts to lock the bitmap, waiting for no longer than the specified length of time.

Namespace:  System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

public bool TryLock(
	Duration timeout


Type: System.Windows.Duration

A Duration that represents the length of time to wait. A value of 0 returns immediately. A value of Forever blocks indefinitely.

Return Value

Type: System.Boolean
true if the lock was acquired; otherwise, false.


timeout is set to Automatic.

When a lock is acquired, the behavior of the TryLock method is the same as the Lock method.

.NET Framework

Supported in: 4.6, 4, 3.5 SP1, 3.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft