Gets or sets the user interface (UI) visibility of this element. This is a dependency property.

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

[LocalizabilityAttribute(LocalizationCategory.None, Readability = Readability.Unreadable)]
public Visibility Visibility { get; set; }
[LocalizabilityAttribute(LocalizationCategory::None, Readability = Readability::Unreadable)]
property Visibility Visibility {
	Visibility get();
	void set(Visibility value);
[<LocalizabilityAttribute(LocalizationCategory.None, Readability = Readability.Unreadable)>]
member Visibility : Visibility with get, set
<LocalizabilityAttribute(LocalizationCategory.None, Readability := Readability.Unreadable)>
Public Property Visibility As Visibility

Property Value


A value of the enumeration. The default value is Visible.


Setting this property affects the value of , which in turn may raise the IsVisibleChanged event. However, has other factors that influence it, for instance the visibility settings of parents that contain it.

Elements where is not Visible do not participate in input events (or commands), do not influence either the Measure or Arrange passes of layout, are not in a tab sequence, and will not be reported in hit testing.

When inherited by Window or its derived classes, Window redefines the default value of this property to be Collapsed. This has the effect of not running the Measure pass of layout on an initially created Window, and returns (0,0). For details, see Window. Popup also redefines the default value to be Collapsed, with similar resulting behavior for Popup and its derived classes.

Identifier field


Metadata properties set to true



The following example implements a handler that references two different named buttons that are intended to be a mutually exclusive pair in the user interface. Prior to running the actual program logic associated with the button, the button itself is set to be VisibilityHidden, and the other button in the pair is set to VisibilityVisible.

private void PlayMedia(object sender, MouseButtonEventArgs args)
    pauseBTN.Visibility = Visibility.Visible;
    playBTN.Visibility = Visibility.Collapsed;

    media.SpeedRatio = 1.0;
Private Sub PlayMedia(ByVal sender As Object, ByVal args As MouseButtonEventArgs)
    pauseBTN.Visibility = System.Windows.Visibility.Visible
    playBTN.Visibility = System.Windows.Visibility.Collapsed

    media.SpeedRatio = 1.0

End Sub 'PlayMedia
Version Information
.NET Framework
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top