title: Hide WPF DataGrid Scrollbar
body: <p>I am new to <code>WPF</code>. I was having bit different requirement with <code>DataGrid</code> so i transform it as below but i dont want any of the scrollbar but its not getting hidden. I have used <code>LayoutTransform</code> here row becomes column and column becomes row. </p>
  
  <pre><code>&lt;DataGrid x:Name="fuelDataGrid" Width="200" Height="900" 
            AutoGenerateColumns="False"
            ItemsSource="{Binding Pump}"
            HorizontalAlignment="Left" FontSize="14"
            VerticalAlignment="Top" 
            HeadersVisibility="None"  
            CanUserReorderColumns="False" 
            CanUserResizeColumns="False" 
            CanUserResizeRows="False" 
            CanUserSortColumns="False" 
            Cursor="Hand" SelectionMode="Single" 
            HorizontalScrollBarVisibility="Disabled" 
            CanUserAddRows="False" 
            CanUserDeleteRows="False" 
            PreviewMouseLeftButtonUp="dataGrid2_PreviewMouseLeftButtonUp"  
            VerticalScrollBarVisibility="Disabled" 
            ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
            ScrollViewer.VerticalScrollBarVisibility="Disabled" 
            MouseDoubleClick="DataGrid_MouseDoubleClick" 
            TargetUpdated="DataGrid_OnTargetUpdated"&gt;
  
      &lt;DataGrid.Resources&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" 
             Color="#FFCBCBCB"/&gt;
      &lt;/DataGrid.Resources&gt;
  
      &lt;DataGrid.ColumnHeaderStyle&gt;
          &lt;Style TargetType="{x:Type DataGridColumnHeader}"&gt;
              &lt;Setter Property="LayoutTransform"&gt;
                  &lt;Setter.Value&gt;
                      &lt;TransformGroup&gt;
                          &lt;RotateTransform Angle="90"/&gt;
                      &lt;/TransformGroup&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="Width" Value="65"/&gt;
              &lt;!--&lt;Setter Property="Height" Value="30"/&gt;--&gt;
          &lt;/Style&gt;
      &lt;/DataGrid.ColumnHeaderStyle&gt;
  
      &lt;DataGrid.LayoutTransform&gt;
          &lt;TransformGroup&gt;
              &lt;RotateTransform Angle="-90"/&gt;
          &lt;/TransformGroup&gt;
      &lt;/DataGrid.LayoutTransform&gt;
  
      &lt;DataGrid.CellStyle&gt;
          &lt;Style TargetType="{x:Type DataGridCell}"&gt;
              &lt;Setter Property="LayoutTransform"&gt;
                  &lt;Setter.Value&gt;
                      &lt;TransformGroup&gt;
                          &lt;RotateTransform Angle="90"/&gt;
                      &lt;/TransformGroup&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="Width" Value="100"/&gt;
              &lt;Setter Property="Foreground" Value="Black" /&gt;
              &lt;!--&lt;Setter Property="Height" Value="30"/&gt;--&gt;
          &lt;/Style&gt;
      &lt;/DataGrid.CellStyle&gt;
  
      &lt;DataGrid.Columns&gt;
          &lt;!--    &lt;DataGridTextColumn Header="Old Price" Binding="{Binding Row1Value}" /&gt; --&gt;
          &lt;DataGridTemplateColumn Header="Old Price"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                   // Code here
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
          &lt;DataGridTemplateColumn Header="Current Price"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                  // Code here
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt; 
  &lt;/DataGrid.Columns&gt;
  </code></pre>
  
  <p></p>
  
  <p>I tried below with Hidden as well. But nothing is working. </p>
  
  <pre><code>VerticalScrollBarVisibility="Hidden" 
  ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
  ScrollViewer.VerticalScrollBarVisibility="Hidden"
  HorizontalScrollBarVisibility="Hidden"
  </code></pre>