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.

Visibility Enumeration

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Specifies the display state of an element.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public enum Visibility
<object property="enumMemberName"/>

Member nameDescription
VisibleDisplay the element.
CollapsedDo not display the element, and do not reserve space for it in layout.

Elements that have a Visibility value of Collapsed do not occupy any layout space. By default, elements are Visible.

WPF has a Visibility state of Hidden. Windows Phone does not support the Hidden Visibility state. If you are migrating XAML UI definitions from WPF XAML, you will have to edit any cases that attempt to set a Visibility to Hidden.

Visibility in a Visual State

As part of defining visual states for a control, you will sometimes want to change the Visibility state of an object to Hidden. Visual states rely on animations. The property value type of UIElement.Visibility is Visibility, an enumeration. To animate values that are enumerations, you must use a DiscreteObjectKeyFrame.

The following XAML example shows a visual state that uses DiscreteObjectKeyFrame to change visibility.

<VisualState x:Name="Focused">
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0">
      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone