title: MultiBinding of grid visiblity in WPF
body: <p>I have a list view Item 
  and I want to collapse some of the items in the row of the list
  I am using the grid for editing the data template.
  I tried to work with multi-binding for the parameter
  however I got that "DependencyProperty.UnsetValue"
  would be happy for a code example.</p>
  
  <p>if I am using 1 parameter all good.</p>
  
  <p>can someone please explain to me how to use multi-binding 
  would be happy with a code example.
  thanks.</p>
  
  <p>Working code for 1 parmaeter I can use this code:</p>
  
  <pre><code>&lt;ListView x:Name="LVGuiCoreBus" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" MouseDown="LVGui_MouseDown"  Grid.Row="1" &gt;               
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid Visibility="{Binding Source, Converter={StaticResource VisiblieGroupFilterBySourcecs}}"&gt;                                                                                                                              
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="130"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="50"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="50"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="100"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;                                                      
                      &lt;ColumnDefinition Width="70"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="1*"&gt;&lt;/ColumnDefinition&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
  
                  &lt;TextBlock Text="{Binding DateNTimeStr}"  Foreground="Green" Grid.Column="0" /&gt;
                      &lt;TextBlock Text="{Binding Source}" Foreground="{Binding Source,Converter={StaticResource CoreBusPanelModuleColorConverter}}" Grid.Column="2" Background="{ Binding Source, Converter={StaticResource BackGroundFilterConverterBySource}}" /&gt;
                      &lt;TextBlock Text="{Binding Destination}" Foreground="{Binding Destination,Converter={StaticResource CoreBusPanelModuleColorConverter}}" Grid.Column="4" Background="{ Binding Destination, Converter={StaticResource BackGroundFilterConvertorByDestantation}}"  /&gt;
                      &lt;TextBlock Text="{Binding Module}" Grid.Column="6" HorizontalAlignment="Center" Background="{ Binding Module, Converter={StaticResource BackGroundFilterByModule}}"   /&gt;
                      &lt;TextBlock Text="{Binding Controll}" Grid.Column="8"  Background="{ Binding Controll, Converter={StaticResource BackGRoundFilterByControll}}"  /&gt;
                      &lt;TextBlock Text="{Binding Command}" Grid.Column="10" HorizontalAlignment="Center"  Background="{ Binding Command, Converter={StaticResource BackGroundFilterByCommand}}"  /&gt;
                      &lt;TextBlock Text="{Binding HSCommand}" Grid.Column="12" HorizontalAlignment="Center"  Background="{ Binding HSCommand, Converter={StaticResource BackGroundFilterByHsCommand}}"   /&gt;
                  &lt;TextBlock Text="{Binding Data_Str}"  Grid.Column="14"/&gt;                                                                
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
      &lt;ListView.ContextMenu&gt;
          &lt;ContextMenu x:Name="CMMenuCopy"&gt;
              &lt;MenuItem x:Name="MCICopyLine" Header="Copy Line" Click="MCICopyLine_Click" &gt;&lt;/MenuItem&gt;
              &lt;MenuItem x:Name="MCICopyText" Header="Copy Only Data Array" Click="MCICopyText_Click" &gt;&lt;/MenuItem&gt;
              &lt;MenuItem x:Name="MCIClear" Header="Clear" Click="MCIClear_Click"&gt;&lt;/MenuItem&gt;
          &lt;/ContextMenu&gt;
      &lt;/ListView.ContextMenu&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>not working code multibinding:</p>
  
  <pre><code>&lt;ListView x:Name="LVGuiCoreBus" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" MouseDown="LVGui_MouseDown"  Grid.Row="1" &gt;               
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid&gt;
                    &lt;Grid.Visibility&gt;
                                      &lt;MultiBinding Converter="{StaticResource MultiValueConvertorVisibility}" UpdateSourceTrigger="PropertyChanged"&gt;
                                          &lt;Binding ElementName="Source" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                          &lt;Binding ElementName="Destination" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                          &lt;Binding ElementName="Module" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                          &lt;Binding ElementName="Controll" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                          &lt;Binding ElementName="Command" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                          &lt;Binding ElementName="HSCommand" Path="Visibility"  UpdateSourceTrigger="PropertyChanged"&gt;&lt;/Binding&gt;
                                      &lt;/MultiBinding&gt;
                                  &lt;/Grid.Visibility&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="130"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="50"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="50"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="100"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;                                                      
                      &lt;ColumnDefinition Width="70"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="150"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="10"&gt;&lt;/ColumnDefinition&gt;
                      &lt;ColumnDefinition Width="1*"&gt;&lt;/ColumnDefinition&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
  
                  &lt;TextBlock Text="{Binding DateNTimeStr}"  Foreground="Green" Grid.Column="0" /&gt;
                      &lt;TextBlock Text="{Binding Source}" Foreground="{Binding Source,Converter={StaticResource CoreBusPanelModuleColorConverter}}" Grid.Column="2" Background="{ Binding Source, Converter={StaticResource BackGroundFilterConverterBySource}}" /&gt;
                      &lt;TextBlock Text="{Binding Destination}" Foreground="{Binding Destination,Converter={StaticResource CoreBusPanelModuleColorConverter}}" Grid.Column="4" Background="{ Binding Destination, Converter={StaticResource BackGroundFilterConvertorByDestantation}}"  /&gt;
                      &lt;TextBlock Text="{Binding Module}" Grid.Column="6" HorizontalAlignment="Center" Background="{ Binding Module, Converter={StaticResource BackGroundFilterByModule}}"   /&gt;
                      &lt;TextBlock Text="{Binding Controll}" Grid.Column="8"  Background="{ Binding Controll, Converter={StaticResource BackGRoundFilterByControll}}"  /&gt;
                      &lt;TextBlock Text="{Binding Command}" Grid.Column="10" HorizontalAlignment="Center"  Background="{ Binding Command, Converter={StaticResource BackGroundFilterByCommand}}"  /&gt;
                      &lt;TextBlock Text="{Binding HSCommand}" Grid.Column="12" HorizontalAlignment="Center"  Background="{ Binding HSCommand, Converter={StaticResource BackGroundFilterByHsCommand}}"   /&gt;
                  &lt;TextBlock Text="{Binding Data_Str}"  Grid.Column="14"/&gt;                                                                
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
      &lt;ListView.ContextMenu&gt;
          &lt;ContextMenu x:Name="CMMenuCopy"&gt;
              &lt;MenuItem x:Name="MCICopyLine" Header="Copy Line" Click="MCICopyLine_Click" &gt;&lt;/MenuItem&gt;
              &lt;MenuItem x:Name="MCICopyText" Header="Copy Only Data Array" Click="MCICopyText_Click" &gt;&lt;/MenuItem&gt;
              &lt;MenuItem x:Name="MCIClear" Header="Clear" Click="MCIClear_Click"&gt;&lt;/MenuItem&gt;
          &lt;/ContextMenu&gt;
      &lt;/ListView.ContextMenu&gt;
  &lt;/ListView&gt;
   public class MultiValueConvertorVisibility : IMultiValueConverter
   {
   public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
          bool x = System.Convert.ToBoolean(values[0]);
          if (x)
          {
              return System.Windows.Visibility.Visible;
          }
          else
          {
              return System.Windows.Visibility.Collapsed;
          }
      }
  
      public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
      {
          throw new NotImplementedException();
      }
   }
  </code></pre>