title: Generic style to hide or show all the TableRows in Table
body: <p>I have FlowDocumentScrollViewer that contains a Table and each table row contains two cells which contains some text. Here is my xaml. </p>
  
  <pre><code>&lt;FlowDocumentScrollViewer
              BorderBrush="Black"
              BorderThickness="1"
              VerticalScrollBarVisibility="Auto"
              HorizontalScrollBarVisibility="Auto"
              Grid.Row="0"
              Grid.Column="0"
              VerticalAlignment="Top"&gt;
              &lt;FlowDocument&gt;
                  &lt;Table
                      CellSpacing="1.2"&gt;
                      &lt;Table.Columns&gt;
                          &lt;TableColumn /&gt;
                          &lt;TableColumn /&gt;
                      &lt;/Table.Columns&gt;
                      &lt;TableRowGroup&gt;
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Instrument Serial Number:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding InstrumentSerialNumber}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Plate Name:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding PlateName}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Date of Run:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding DateOfRun}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="User Name of Run Initiator:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding UserName}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Thermal Cycling Protocol Name:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding ThermalCyclerName}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Thermal Cycling Definition:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding ThermalCyclerDefinition}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Bar Code:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding BarCode}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="SuperMix Type:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding SuperMixName}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Number Of Wells Generated:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding NumberOfWells}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Number Of Wells Read:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding NumberOfWellsRead}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Oil Name:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding OilName}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Total Plate Run Time:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding TotalPlateRunTime}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Errors:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding Errors}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Software Version:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding SoftwareVersion}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
  
                          &lt;TableRowHelper:BRTableRow&gt;
                              &lt;TableCell
                                  TextAlignment="Center"&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="Firmware Version:"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                              &lt;TableCell&gt;
                                  &lt;Paragraph
                                      FontWeight="Bold"&gt;
                                      &lt;Run
                                          Text="{Binding FirmwareVersion}"&gt;&lt;/Run&gt;
                                  &lt;/Paragraph&gt;
                              &lt;/TableCell&gt;
                          &lt;/TableRowHelper:BRTableRow&gt;
                      &lt;/TableRowGroup&gt;
                  &lt;/Table&gt;
              &lt;/FlowDocument&gt;
          &lt;/FlowDocumentScrollViewer&gt;
  </code></pre>
  
  <p>Please see TableRowHelper:BRTableRow which is a custom control where I created a dependency property for visibility to hide or show a Table Row. Here is the code.</p>
  
  <pre><code>public class BRTableRow : TableRow
      {
          public Visibility IsRowVisible
          {
              get
              {
                  return (Visibility)GetValue(RowVisibleDependencyProperty);
              }
              set
              {
                  SetValue(RowVisibleDependencyProperty, value);
              }
          }
          public static readonly DependencyProperty RowVisibleDependencyProperty =
              DependencyProperty.Register("IsRowVisible", typeof(Visibility), typeof(BRTableRow), new PropertyMetadata());
      }
  </code></pre>
  
  <p>Is there a generic style trigger that I can apply on visibility of each table row. For example if the text i.e. {Binding InstrumentSerialNumber}. If this text is empty I want to collapse the visibility. So on and so forth. But I don't want to create multiple styles. I just want 1 style that I can use on all Table Rows. Any ideas. Please help. </p>