# C1.WPF.FlexGrid.C1FlexGrid.KeepCurrentVisible

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_FlexGrid_C1FlexGrid_KeepCurrentVisible_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.KeepCurrentVisible*">KeepCurrentVisible Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_FlexGrid_C1FlexGrid_KeepCurrentVisible_" data-uid="C1.WPF.FlexGrid.C1FlexGrid.KeepCurrentVisible*"></a>
<h4 id="C1_WPF_FlexGrid_C1FlexGrid_KeepCurrentVisible" data-uid="C1.WPF.FlexGrid.C1FlexGrid.KeepCurrentVisible">KeepCurrentVisible</h4>
<div class="markdown level1 summary"><p>Gets or sets a value that indicates whether the grid should automatically
scroll to keep the current item visible.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool KeepCurrentVisible { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property KeepCurrentVisible As Boolean</code></pre>
</div>
<h5 id="C1_WPF_FlexGrid_C1FlexGrid_KeepCurrentVisible_remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;This property applies only to bound mode. If &lt;xref href=&quot;C1.WPF.FlexGrid.C1FlexGrid.KeepCurrentVisible&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt;
</code></pre>
<p>is set to true, then the grid will automatically scroll to show the item that is
selected in the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.icollectionview">ICollectionView</a> being used as an items source.
The current selection may be set in code, or by selecting an item in another
control that is bound to the same data source.</p>
</div>
<h5 id="C1_WPF_FlexGrid_C1FlexGrid_KeepCurrentVisible_examples">Examples</h5>
<p>The code below causes the grid to automatically scroll to show the current item
whenever the &quot;Top&quot; or &quot;Bottom&quot; buttons are clicked:</p>
<pre><code class="lang-csharp">public MainPage()
{
  InitializeComponent();
  _flex..KeepCurrentVisible = true;
}

void Top_Click(object sender, RoutedEventArgs e)
{
  _flex.CollectionView.MoveCurrentToFirst();
}
void Bottom_Click(object sender, RoutedEventArgs e)
{
  _flex.CollectionView.MoveCurrentToLast();
}</code></pre>

</div>
