Compartilhar via


IXRUIElement::SetOpacity (Compact 2013)

3/28/2014

This method determines the degree of opacity of a UI element.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetOpacity(
    __in float Opacity
) = 0; 

Parameters

  • pOpacity
    [in] Value that describes the opacity of this object. The range for this value is between 0 and 1.0 (1.0 means full opacity, and 0 means transparent). The default value is 1.0.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

An opacity value of 0 does not exclude an element from hit testing. This behavior can be useful for creating ImageMap-style overlays of IXRCanvas, IIXRRectangle, or other shapes to capture hits on elements that exist at z-orders greater than other visible elements underneath. To exclude an element from hit testing, call IXRUIElement::SetIsHitTestVisible and set IsHitTestVisible to false.

When an opacity value is set on elements that are nested, the effective opacity is the product of all applicable opacity factors. For example, if an element that has opacity=0.5 is contained in an IXRCanvas object that also has opacity=0.5, the resulting opacity value is 0.25.

.NET Framework Equivalent

System.Windows.UIElement.Opacity

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRUIElement
IXRUIElement::GetOpacity