---
title: "How can I set visibility of a Grid using WPF"  
description: "How can I set visibility of a Grid using WPF"  
author: "Aaron Douglas"  
published: 2013-10-14  
updated: 2013-10-14  
canonical: https://www.mindstick.com/forum/1679/how-can-i-set-visibility-of-a-grid-using-wpf  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How can I set visibility of a Grid using WPF

I have a [home page](https://answers.mindstick.com/qa/95562/how-do-i-change-the-safari-home-page-on-a-mac) and in that i have 2 grids, one [internal](https://www.mindstick.com/interview/773/describe-the-accessibility-modifier-protected-internal) and another external. In the [parent](https://www.mindstick.com/blog/154/how-to-find-parent-of-control-in-wpf) [grid](https://www.mindstick.com/forum/369/how-can-i-add-a-column-name-to-my-grid) i have a [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)-grid.when am clicking on the [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table) of the datagrid i need to make visible the child grid which contains the [controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net) that is binded to the clicked row values.

## Replies

### Reply by Anonymous User

```
<Grid Grid.Row="1" Visibility={Binding SelectedEmployee, Converter={StaticResource NotNullToVisibilityConverter}} ...>
```

Here is the converter code:

```
public class NotNullToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return Visibility.Hidden; // or Visibility.Collapsed

            return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
```


---

Original Source: https://www.mindstick.com/forum/1679/how-can-i-set-visibility-of-a-grid-using-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
