Home > DeveloperSection > Forums > How can I set visibility of a Grid using WPF
Aaron Douglas
Aaron Douglas

Total Post:20

Posted on    October-14-2013 7:41 AM

 C# C# 

 1 Reply(s)
 1568  View(s)
Rate this:

I have a home page and in that i have 2 grids, one internal and another external. In the parent grid i have a data-grid.when am clicking on the row of the datagrid i need to make visible the child grid which contains the controls that is binded to the clicked row values.

Brad Pitt
Brad Pitt

Total Post:61

Posted on    October-14-2013 7:55 AM

<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();

Don't want to miss updates? Please click the below button!

Follow MindStick